From 0b9c01a8fe0b01c023d8f671703157123c84b8a9 Mon Sep 17 00:00:00 2001 From: BorisMoore Date: Sat, 28 May 2016 15:27:06 -0700 Subject: [PATCH] Commit 76 (v0.9.76 - Beta) - New support for compiled View Models - using $.views.viewModels(...), and new map(), merge() and unmap() APIs for converting between plain object hierarchies and compiled View Model hierarchies - covered by the new documentation topics: http://www.jsviews.com/#jsrmodel, http://www.jsviews.com/#viewmodelsapi, http://www.jsviews.com/#jsvmodel and http://www.jsviews.com/#jsvviewmodelsapi. - Added escaping of = in {{>...}} and {{html:...}} - Prevent use of ['constructor'] in template expressions (so cannot instantiate new Function) - Several minor bug fixes - Several new and improved documentation topics: http://www.jsviews.com/#jsvapps Building apps (JsViews) http://www.jsviews.com/#jsrmodel Data / View Model (JsRender) http://www.jsviews.com/#jsvmodel Data / View Model (JsViews) http://www.jsviews.com/#viewmodelsapi Compiled View Models (JsViews) http://www.jsviews.com/#jsvviewmodelsapi Compiled View Models (JsViews) http://www.jsviews.com/#node/webpack Webpack support http://www.jsviews.com/#node/browserify Browserify support - Keyboard shortcuts provided for 'Search' on www.jsviews.com: Ctrl+/: search, Enter: new search, Escape: quit, Ctrl+Left/Right Arrow: Prev/Next result - Many additional unit tests --- README.md | 7 +- jsrender-node.js | 372 ++- jsrender.js | 357 ++- jsrender.min.js | 6 +- jsrender.min.js.map | 2 +- package.json | 6 +- test/browserify/1-unit-tests.js | 6 +- test/browserify/12-nested-unit-tests.js | 39 + test/browserify/2-unit-tests.js | 6 +- test/browserify/3-unit-tests.js | 6 +- test/browserify/bundles/1-bundle.js | 365 ++- test/browserify/bundles/12-nested-bundle.js | 2408 +++++++++++++++++ test/browserify/bundles/2-bundle.js | 365 ++- test/browserify/bundles/3-bundle.js | 365 ++- .../bundles/htm-jsrender-tmpl-bundle.js | 370 ++- .../bundles/html-jsr-tmpl-bundle.js | 370 ++- test/browserify/htm-jsrender-tmpl.js | 13 +- test/browserify/html-jsr-tmpl.js | 13 +- test/browserify/tests-browserify-completed.js | 8 +- test/unit-tests-browserify.html | 1 + test/unit-tests/requirejs-config.js | 2 +- test/unit-tests/tests-jsrender-no-jquery.js | 24 +- test/unit-tests/tests-jsrender-with-jquery.js | 215 +- test/unit-tests/tests-node.js | 7 +- tmplify/index.js | 13 +- 25 files changed, 4934 insertions(+), 412 deletions(-) create mode 100644 test/browserify/12-nested-unit-tests.js create mode 100644 test/browserify/bundles/12-nested-bundle.js diff --git a/README.md b/README.md index 0facafc..b7748c7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ **[JsRender](https://github.com/BorisMoore/jsrender)** and **[JsViews](https://github.com/BorisMoore/jsviews)** together provide the next-generation implementation of the official jQuery plugins *[JQuery Templates](https://github.com/BorisMoore/jquery-tmpl)*, and *[JQuery Data Link](https://github.com/BorisMoore/jquery-datalink)* -- and supersede those libraries. -

Documentation and Downloads

+

Documentation and downloads

**[Documentation](http://www.jsviews.com)**, **[downloads](http://www.jsviews.com/#download)**, **[samples](http://www.jsviews.com/#samples)** and **[API docs and tutorials](http://www.jsviews.com/#jsrapi)** are available on the **[www.jsviews.com website](http://www.jsviews.com/#jsrender)**. The content of this ***ReadMe*** is available also as a *[JsRender Quickstart](http://www.jsviews.com/#jsr-quickstart)*. @@ -16,7 +16,7 @@ JsRender is used for data-driven rendering of templates to strings, ready for in It is also used by the *[JsViews](http://www.jsviews.com/#jsviews)* platform, which adds data binding to JsRender templates, and provides a fully-fledged MVVM platform for easily creating interactive data-driven single page apps and websites. -

JsRender Installation

+

JsRender installation

*jsrender.js* is available from [downloads](http://www.jsviews.com/#download) on the jsviews.com site. @@ -26,6 +26,7 @@ Alternatively: - It can be installed with ***[Bower](http://bower.io/search/?q=jsrender)***, using `$ bower install jsrender` - It can be loaded using an *AMD script loader*, such as RequireJS - For installation using *Node.js* (*npm*) see *[JsRender Node.js Quickstart](http://www.jsviews.com/#jsr-node-quickstart)* +- (For browser loading using *Browserify* or *webpack* -- see also *[JsRender Node.js Quickstart](http://www.jsviews.com/#jsr-node-quickstart)*)

Using JsRender with jQuery

When jQuery is present, JsRender loads as a jQuery plugin and adds `$.views`, `$.templates` and `$.render` to the jQuery namespace object, `$` (or `window.jQuery`). @@ -56,7 +57,7 @@ It also provides built-in *Express*, *Hapi* and *Browserify* integration -- whic **Code samples:** See *[JsRender Node Starter](https://github.com/BorisMoore/jsrender-node-starter)* for running code examples of Node.js scenarios, including with *Express*, *Hapi* and *Browserify*. -

JsRender Usage

+

JsRender usage

Define a template

diff --git a/jsrender-node.js b/jsrender-node.js index fa14244..6e892db 100644 --- a/jsrender-node.js +++ b/jsrender-node.js @@ -1,4 +1,4 @@ -/*! JsRender v0.9.75 (Beta): http://jsviews.com/#jsrender */ +/*! JsRender v0.9.76 (Beta): http://jsviews.com/#jsrender */ /*! **VERSION FOR NODE.JS** (For WEB see http://jsviews.com/download/jsrender.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -19,7 +19,7 @@ if (typeof exports !== 'object' ) { //========================== Top-level vars ========================== -var versionNumber = "v0.9.75", +var versionNumber = "v0.9.76", // global var is the this object, which is window when running in the usual browser environment @@ -42,8 +42,8 @@ var versionNumber = "v0.9.75", rBuildHash = /(?:\x08|^)(onerror:)?(?:(~?)(([\w$_\.]+):)?([^\x08]+))\x08(,)?([^\x08]+)/gi, rTestElseIf = /^if\s/, rFirstElem = /<(\w+)[>\s]/, - rAttrEncode = /[\x00`><"'&]/g, // Includes > encoding since rConvertMarkers in JsViews does not skip > characters in attribute strings - rIsHtml = /[\x00`><\"'&]/, + rAttrEncode = /[\x00`><"'&=]/g, // Includes > encoding since rConvertMarkers in JsViews does not skip > characters in attribute strings + rIsHtml = /[\x00`><\"'&=]/, rHasHandlers = /^on[A-Z]|^convert(Back)?$/, rHtmlEncode = rAttrEncode, viewId = 0, @@ -54,7 +54,8 @@ var versionNumber = "v0.9.75", "\x00": "�", "'": "'", '"': """, - "`": "`" + "`": "`", + "=": "=" }, HTML = "html", OBJECT = "object", @@ -70,11 +71,14 @@ var versionNumber = "v0.9.75", tag: { compile: compileTag }, + viewModel: { + compile: compileViewModel + }, helper: {}, converter: {} }; -// views object ($.views if jQuery is loaded, jsrender.views if no jQuery, e.g. in Node.js) + // views object ($.views if jQuery is loaded, jsrender.views if no jQuery, e.g. in Node.js) $views = { jsviews: versionNumber, sub: { @@ -98,7 +102,13 @@ var versionNumber = "v0.9.75", _tag: renderTag, _er: error, _err: onRenderError, - _html: htmlEncode + _html: htmlEncode, + _sq: function(token) { + if (token === "constructor") { + syntaxError(""); + } + return token; + } }, settings: { delimiters: $viewsDelimiters, @@ -166,7 +176,6 @@ function noop() { function dbgBreak(val) { // Usage examples: {{dbg:...}}, {{:~dbg(...)}}, {{dbg .../}}, {^{for ... onAfterLink=~dbg}} etc. try { - debugger; console.log("JsRender dbg breakpoint: " + val); throw "dbg breakpoint"; // To break here, stop on caught exceptions. } @@ -182,8 +191,7 @@ function JsViewsError(message) { } function $extend(target, source) { - var name; - for (name in source) { + for (var name in source) { target[name] = source[name]; } return target; @@ -654,9 +662,9 @@ View.prototype = { _is: "view" }; -//============= +//==================================================== // Registration -//============= +//==================================================== function compileChildResources(parentTmpl) { var storeName, resources, resourceName, resource, settings, compile, onStore; @@ -676,6 +684,10 @@ function compileChildResources(parentTmpl) { } } +//=============== +// compileTag +//=============== + function compileTag(name, tagDef, parentTmpl) { var tmpl, baseTag, prop, compiledDef = new $sub._tg(); @@ -736,6 +748,10 @@ function baseApply(args) { return this.base.apply(this, args); } +//=============== +// compileTmpl +//=============== + function compileTmpl(name, tmpl, parentTmpl, options) { // tmpl is either a template object, a selector for a template script block, the name of a compiled template, or a template object @@ -755,8 +771,16 @@ function compileTmpl(name, tmpl, parentTmpl, options) { // NODE.JS-SPECIFIC CODE: // Load template file from the file system // Consider supporting/using async version with callback: nodeFs.readFile(path, {encoding: "utf8"}, callback); - value = compileTmpl(name, nodeFs.readFileSync(value, "utf8").replace(/^\uFEFF/, ''), parentTmpl, options); + try { + value = nodeFs.readFileSync(value, "utf8"); + } + catch(e) { + if(e && e.code == 'ENOENT') { + error("Template '" + value + "' not found at '" + e.path + "'. Use path relative to '" + rootDirPath + "'."); + } + } // Remove BOM if necessary + value = compileTmpl(name, value.replace(/^\uFEFF/, ''), parentTmpl, options); if (!options) { $templates[name] = value; @@ -825,26 +849,229 @@ function compileTmpl(name, tmpl, parentTmpl, options) { //==== /end of function compileTmpl ==== -function dataMap(mapDef) { - function Map(source, options) { - this.tgt = mapDef.getTgt(source, options); +//================= +// compileViewModel +//================= + +function getDefaultVal(defaultVal, data) { + return $.isFunction(defaultVal) + ? defaultVal.call(data) + : defaultVal; +} + +function unmapArray(modelArr) { + var i, arr = [], + l = modelArr.length; + for (i=0; i" : converter + tagName; } - trigger = node[6] || $subSettings.trigger; } else { if (content) { // TODO optimize - if content.length === 0 or if there is a tmpl="..." specified - set content to null / don't run this compilation code - since content won't get used!! // Create template object for nested template @@ -1685,24 +1951,23 @@ function buildCode(ast, tmpl, isLinkExpr) { if (isGetVal && (pathBindings || trigger || converter && converter !== HTML)) { // For convertVal we need a compiled function to return the new tagCtx(s) - tagCtxFn = "return {" + tagCtx + "};"; - tagRender = 'c("' + converter + '",view,'; tagCtxFn = new Function("data,view,j,u", " // " + tmplName + " " + tmplBindingKey + " " + tagName - + "\n" + tagCtxFn); + + "\nreturn {" + tagCtx + "};"); tagCtxFn._er = onError; - - boundOnErrStart = tagRender + tmplBindingKey + ","; - boundOnErrEnd = ")"; - tagCtxFn._tag = tagName; + if (isLinkExpr) { return tagCtxFn; } + setPaths(tagCtxFn, pathBindings); + tagRender = 'c("' + converter + '",view,'; useCnvt = true; + boundOnErrStart = tagRender + tmplBindingKey + ","; + boundOnErrEnd = ")"; } code += (isGetVal - ? (isLinkExpr ? (onError ? "\ntry{\n" : "") + "return " : tagStart) + (useCnvt // Call _cnvt if there is a converter: {{cnvt: ... }} or {^{cnvt: ... }} + ? (isLinkExpr ? (onError ? "try{\n" : "") + "return " : tagStart) + (useCnvt // Call _cnvt if there is a converter: {{cnvt: ... }} or {^{cnvt: ... }} ? (useCnvt = undefined, useViews = hasCnvt = true, tagRender + (pathBindings ? ((tmplBindings[tmplBindingKey - 1] = tagCtxFn), tmplBindingKey) // Store the compiled tagCtxFn in tmpl.bnds, and pass the key to convertVal() : "{" + tagCtx + "}") + ")") @@ -1743,7 +2008,7 @@ function buildCode(ast, tmpl, isLinkExpr) { } if (onError) { useViews = true; - code += ';\n}catch(e){ret' + (isLinkExpr ? "urn " : "+=") + boundOnErrStart + 'j._err(e,view,' + onError + ')' + boundOnErrEnd + ';}\n' + (isLinkExpr ? "" : 'ret=ret'); + code += ';\n}catch(e){ret' + (isLinkExpr ? "urn " : "+=") + boundOnErrStart + 'j._err(e,view,' + onError + ')' + boundOnErrEnd + ';}' + (isLinkExpr ? "" : 'ret=ret'); } } } @@ -1807,7 +2072,7 @@ function getTargetProps(source) { prop = source[key]; if (!prop || !prop.toJSON || prop.toJSON()) { if (!$isFunction(prop)) { - props.push({ key: key, prop: prop }); + props.push({key: key, prop: prop}); } } } @@ -1831,18 +2096,18 @@ function htmlEncode(text) { //========================== Initialize ========================== +$sub = $views.sub; +$viewsSettings = $views.settings; + { // JsRender not already loaded, or loaded without jQuery, and we are now moving from jsrender namespace to jQuery namepace for (jsvStoreName in jsvStores) { registerStore(jsvStoreName, jsvStores[jsvStoreName]); } - $templates = $views.templates; $converters = $views.converters; $helpers = $views.helpers; $tags = $views.tags; - $sub = $views.sub; - $viewsSettings = $views.settings; $sub._tg.prototype = { baseApply: baseApply, @@ -1977,21 +2242,22 @@ function htmlEncode(text) { return text != undefined ? encodeURI("" + text) : text === null ? text : ""; // null returns null, e.g. to remove attribute. undefined returns "" } }); - - //========================== Define default delimiters ========================== - $viewsSettings.delimiters("{{", "}}", "^"); } +//========================== Define default delimiters ========================== +$subSettings = $sub.settings; +$viewsSettings.delimiters("{{", "}}", "^"); // NODE.JS-SPECIFIC CODE: var nodeFs = require('fs'), nodePath = require('path'), nodePathSep = nodePath.sep, - rootDirNameLen = nodePath.resolve("./").length + 1; + rootDirPath = nodePath.resolve("./"), + rootDirPathLen = rootDirPath.length + 1; // Support for rendering templates from file system in Node.js Node, and for Express template engine integration, // using app.engine('html', jsrender.__express); $.renderFile = $.__express = function(filepath, data, callback) { - filepath = './' + nodeFs.realpathSync(filepath).slice(rootDirNameLen).split(nodePathSep).join('/'); // Normalize to ./some/file.html + filepath = './' + nodeFs.realpathSync(filepath).slice(rootDirPathLen).split(nodePathSep).join('/'); // Normalize to ./some/file.html var html = $templates(filepath).render(data); if (callback) { callback(null, html); diff --git a/jsrender.js b/jsrender.js index 233c923..3eb176f 100644 --- a/jsrender.js +++ b/jsrender.js @@ -1,4 +1,4 @@ -/*! JsRender v0.9.75 (Beta): http://jsviews.com/#jsrender */ +/*! JsRender v0.9.76 (Beta): http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -44,7 +44,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v0.9.75", +var versionNumber = "v0.9.76", jsvStoreName, rTag, rTmplString, topView, $views, //TODO tmplFnsCache = {}, @@ -64,8 +64,8 @@ var versionNumber = "v0.9.75", rBuildHash = /(?:\x08|^)(onerror:)?(?:(~?)(([\w$_\.]+):)?([^\x08]+))\x08(,)?([^\x08]+)/gi, rTestElseIf = /^if\s/, rFirstElem = /<(\w+)[>\s]/, - rAttrEncode = /[\x00`><"'&]/g, // Includes > encoding since rConvertMarkers in JsViews does not skip > characters in attribute strings - rIsHtml = /[\x00`><\"'&]/, + rAttrEncode = /[\x00`><"'&=]/g, // Includes > encoding since rConvertMarkers in JsViews does not skip > characters in attribute strings + rIsHtml = /[\x00`><\"'&=]/, rHasHandlers = /^on[A-Z]|^convert(Back)?$/, rHtmlEncode = rAttrEncode, viewId = 0, @@ -76,7 +76,8 @@ var versionNumber = "v0.9.75", "\x00": "�", "'": "'", '"': """, - "`": "`" + "`": "`", + "=": "=" }, HTML = "html", OBJECT = "object", @@ -95,11 +96,14 @@ var versionNumber = "v0.9.75", tag: { compile: compileTag }, + viewModel: { + compile: compileViewModel + }, helper: {}, converter: {} }; -// views object ($.views if jQuery is loaded, jsrender.views if no jQuery, e.g. in Node.js) + // views object ($.views if jQuery is loaded, jsrender.views if no jQuery, e.g. in Node.js) $views = { jsviews: versionNumber, sub: { @@ -123,7 +127,13 @@ var versionNumber = "v0.9.75", _tag: renderTag, _er: error, _err: onRenderError, - _html: htmlEncode + _html: htmlEncode, + _sq: function(token) { + if (token === "constructor") { + syntaxError(""); + } + return token; + } }, settings: { delimiters: $viewsDelimiters, @@ -191,7 +201,6 @@ function noop() { function dbgBreak(val) { // Usage examples: {{dbg:...}}, {{:~dbg(...)}}, {{dbg .../}}, {^{for ... onAfterLink=~dbg}} etc. try { - debugger; console.log("JsRender dbg breakpoint: " + val); throw "dbg breakpoint"; // To break here, stop on caught exceptions. } @@ -207,8 +216,7 @@ function JsViewsError(message) { } function $extend(target, source) { - var name; - for (name in source) { + for (var name in source) { target[name] = source[name]; } return target; @@ -679,9 +687,9 @@ View.prototype = { _is: "view" }; -//============= +//==================================================== // Registration -//============= +//==================================================== function compileChildResources(parentTmpl) { var storeName, resources, resourceName, resource, settings, compile, onStore; @@ -701,6 +709,10 @@ function compileChildResources(parentTmpl) { } } +//=============== +// compileTag +//=============== + function compileTag(name, tagDef, parentTmpl) { var tmpl, baseTag, prop, compiledDef = new $sub._tg(); @@ -761,6 +773,10 @@ function baseApply(args) { return this.base.apply(this, args); } +//=============== +// compileTmpl +//=============== + function compileTmpl(name, tmpl, parentTmpl, options) { // tmpl is either a template object, a selector for a template script block, the name of a compiled template, or a template object @@ -882,26 +898,229 @@ function compileTmpl(name, tmpl, parentTmpl, options) { //==== /end of function compileTmpl ==== -function dataMap(mapDef) { - function Map(source, options) { - this.tgt = mapDef.getTgt(source, options); +//================= +// compileViewModel +//================= + +function getDefaultVal(defaultVal, data) { + return $.isFunction(defaultVal) + ? defaultVal.call(data) + : defaultVal; +} + +function unmapArray(modelArr) { + var i, arr = [], + l = modelArr.length; + for (i=0; i" : converter + tagName; } - trigger = node[6] || $subSettings.trigger; } else { if (content) { // TODO optimize - if content.length === 0 or if there is a tmpl="..." specified - set content to null / don't run this compilation code - since content won't get used!! // Create template object for nested template @@ -1736,24 +1994,23 @@ function buildCode(ast, tmpl, isLinkExpr) { if (isGetVal && (pathBindings || trigger || converter && converter !== HTML)) { // For convertVal we need a compiled function to return the new tagCtx(s) - tagCtxFn = "return {" + tagCtx + "};"; - tagRender = 'c("' + converter + '",view,'; tagCtxFn = new Function("data,view,j,u", " // " + tmplName + " " + tmplBindingKey + " " + tagName - + "\n" + tagCtxFn); + + "\nreturn {" + tagCtx + "};"); tagCtxFn._er = onError; - - boundOnErrStart = tagRender + tmplBindingKey + ","; - boundOnErrEnd = ")"; - tagCtxFn._tag = tagName; + if (isLinkExpr) { return tagCtxFn; } + setPaths(tagCtxFn, pathBindings); + tagRender = 'c("' + converter + '",view,'; useCnvt = true; + boundOnErrStart = tagRender + tmplBindingKey + ","; + boundOnErrEnd = ")"; } code += (isGetVal - ? (isLinkExpr ? (onError ? "\ntry{\n" : "") + "return " : tagStart) + (useCnvt // Call _cnvt if there is a converter: {{cnvt: ... }} or {^{cnvt: ... }} + ? (isLinkExpr ? (onError ? "try{\n" : "") + "return " : tagStart) + (useCnvt // Call _cnvt if there is a converter: {{cnvt: ... }} or {^{cnvt: ... }} ? (useCnvt = undefined, useViews = hasCnvt = true, tagRender + (pathBindings ? ((tmplBindings[tmplBindingKey - 1] = tagCtxFn), tmplBindingKey) // Store the compiled tagCtxFn in tmpl.bnds, and pass the key to convertVal() : "{" + tagCtx + "}") + ")") @@ -1794,7 +2051,7 @@ function buildCode(ast, tmpl, isLinkExpr) { } if (onError) { useViews = true; - code += ';\n}catch(e){ret' + (isLinkExpr ? "urn " : "+=") + boundOnErrStart + 'j._err(e,view,' + onError + ')' + boundOnErrEnd + ';}\n' + (isLinkExpr ? "" : 'ret=ret'); + code += ';\n}catch(e){ret' + (isLinkExpr ? "urn " : "+=") + boundOnErrStart + 'j._err(e,view,' + onError + ')' + boundOnErrEnd + ';}' + (isLinkExpr ? "" : 'ret=ret'); } } } @@ -1858,7 +2115,7 @@ function getTargetProps(source) { prop = source[key]; if (!prop || !prop.toJSON || prop.toJSON()) { if (!$isFunction(prop)) { - props.push({ key: key, prop: prop }); + props.push({key: key, prop: prop}); } } } @@ -1882,18 +2139,18 @@ function htmlEncode(text) { //========================== Initialize ========================== +$sub = $views.sub; +$viewsSettings = $views.settings; + if (!(jsr || $ && $.render)) { // JsRender not already loaded, or loaded without jQuery, and we are now moving from jsrender namespace to jQuery namepace for (jsvStoreName in jsvStores) { registerStore(jsvStoreName, jsvStores[jsvStoreName]); } - $templates = $views.templates; $converters = $views.converters; $helpers = $views.helpers; $tags = $views.tags; - $sub = $views.sub; - $viewsSettings = $views.settings; $sub._tg.prototype = { baseApply: baseApply, @@ -2056,10 +2313,10 @@ if (!(jsr || $ && $.render)) { return text != undefined ? encodeURI("" + text) : text === null ? text : ""; // null returns null, e.g. to remove attribute. undefined returns "" } }); - - //========================== Define default delimiters ========================== - $viewsSettings.delimiters("{{", "}}", "^"); } +//========================== Define default delimiters ========================== +$subSettings = $sub.settings; +$viewsSettings.delimiters("{{", "}}", "^"); if (jsrToJq) { // Moving from jsrender namespace to jQuery namepace - copy over the stored items (templates, converters, helpers...) jsr.views.sub._jq($); diff --git a/jsrender.min.js b/jsrender.min.js index df36733..c67bc37 100644 --- a/jsrender.min.js +++ b/jsrender.min.js @@ -1,4 +1,4 @@ -/*! JsRender v0.9.75 (Beta): http://jsviews.com/#jsrender */ +/*! JsRender v0.9.76 (Beta): http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ -!function(e,t){var n=t.jQuery;"object"==typeof exports?module.exports=n?e(t,n):function(n){if(n&&!n.fn)throw"Provide jQuery or null";return e(t,n)}:"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t,!1)}(function(e,t){"use strict";function n(e,t){return function(){var n,r=this,i=r.base;return r.base=e,n=t.apply(r,arguments),r.base=i,n}}function r(e,t){return W(t)&&(t=n(e?e._d?e:n(o,e):o,t),t._d=1),t}function i(e,t){for(var n in t.props)Ce.test(n)&&(e[n]=r(e[n],t.props[n]))}function a(e){return e}function o(){return""}function s(e){try{throw console.log("JsRender dbg breakpoint: "+e),"dbg breakpoint"}catch(t){}return this.base?this.baseApply(arguments):e}function d(e){this.name=(t.link?"JsViews":"JsRender")+" Error",this.message=e||this.name}function l(e,t){var n;for(n in t)e[n]=t[n];return e}function u(e,t,n){return e?(ie.delimiters=[e,t,pe=n?n.charAt(0):pe],se=e.charAt(0),de=e.charAt(1),le=t.charAt(0),ue=t.charAt(1),e="\\"+se+"(\\"+pe+")?\\"+de,t="\\"+le+"\\"+ue,P="(?:(\\w+(?=[\\/\\s\\"+le+"]))|(\\w+)?(:)|(>)|(\\*))\\s*((?:[^\\"+le+"]|\\"+le+"(?!\\"+ue+"))*?)",re.rTag="(?:"+P+")",P=new RegExp("(?:"+e+P+"(\\/)?|\\"+se+"(\\"+pe+")?\\"+de+"(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))"+t,"g"),Z=new RegExp("<.*>|([^\\\\]|^)[{}]|"+e+".*"+t),oe):ie.delimiters}function p(e,t){t||e===!0||(t=e,e=void 0);var n,r,i,a,o=this,s=!t||"root"===t;if(e){if(a=t&&o.type===t&&o,!a)if(n=o.views,o._.useKey){for(r in n)if(a=t?n[r].get(e,t):n[r])break}else for(r=0,i=n.length;!a&&i>r;r++)a=t?n[r].get(e,t):n[r]}else if(s)for(;o.parent;)a=o,o=o.parent;else for(;o&&!a;)a=o.type===t?o:void 0,o=o.parent;return a}function c(){var e=this.get("item");return e?e.index:void 0}function f(){return this.index}function g(t){var n,r=this,i=r.linkCtx,a=(r.ctx||{})[t];return void 0===a&&i&&i.ctx&&(a=i.ctx[t]),void 0===a&&(a=te[t]),a&&W(a)&&!a._wrp&&(n=function(){return a.apply(this&&this!==e?this:r,arguments)},n._wrp=r,l(n,a)),n||a}function v(e){return e&&(e.fn?e:this.getRsc("templates",e)||Y(e))}function m(e,t,n,r){var a,o,s="number"==typeof n&&t.tmpl.bnds[n-1],d=t.linkCtx;return void 0!==r?n=r={props:{},args:[r]}:s&&(n=s(t.data,t,re)),o=n.args[0],(e||s)&&(a=d&&d.tag,a||(a=l(new re._tg,{_:{inline:!d,bnd:s,unlinked:!0},tagName:":",cvt:e,flow:!0,tagCtx:n}),d&&(d.tag=a,a.linkCtx=d),n.ctx=O(n.ctx,(d?d.view:t).ctx)),a._er=r&&o,i(a,n),n.view=t,a.ctx=n.ctx||{},n.ctx=void 0,o=a.cvtArgs(a.convert||"true"!==e&&e)[0],o=s&&t._.onRender?t._.onRender(o,t,a):o),void 0!=o?o:""}function h(e){var t=this,n=t.tagCtx,r=n.view,i=n.args;return e=t.convert||e,e=e&&(""+e===e?r.getRsc("converters",e)||N("Unknown converter: '"+e+"'"):e),i=i.length||n.index?e?i.slice():i:[r.data],e&&(e.depends&&(t.depends=re.getDeps(t.depends,t,e.depends,e)),i[0]=e.apply(t,i)),i}function w(e,t){for(var n,r,i=this;void 0===n&&i;)r=i.tmpl&&i.tmpl[e],n=r&&r[t],i=i.parent;return n||G[e][t]}function x(e,t,n,r,a,o){t=t||z;var s,d,l,u,p,c,f,g,v,m,h,w,x,b,_,y,k,j,C,T="",A=t.linkCtx||0,R=t.ctx,$=n||t.tmpl,M="number"==typeof r&&t.tmpl.bnds[r-1];for("tag"===e._is?(s=e,e=s.tagName,r=s.tagCtxs,l=s.template):(d=t.getRsc("tags",e)||N("Unknown tag: {{"+e+"}} "),l=d.template),void 0!==o?(T+=o,r=o=[{props:{},args:[]}]):M&&(r=M(t.data,t,re)),g=r.length,f=0;g>f;f++)m=r[f],(!A||!A.tag||f&&!A.tag._.inline||s._er)&&((w=$.tmpls&&m.tmpl)&&(w=m.content=$.tmpls[w-1]),m.index=f,m.tmpl=w,m.render=V,m.view=t,m.ctx=O(m.ctx,R)),(n=m.props.tmpl)&&(m.tmpl=t.getTmpl(n)),s||(s=new d._ctr,x=!!s.init,s.parent=c=R&&R.tag,s.tagCtxs=r,C=s.dataMap,A&&(s._.inline=!1,A.tag=s,s.linkCtx=A),(s._.bnd=M||A.fn)?s._.arrVws={}:s.dataBoundOnly&&N("{^{"+e+"}} tag must be data-bound")),r=s.tagCtxs,C=s.dataMap,m.tag=s,C&&r&&(m.map=r[f].map),s.flow||(h=m.ctx=m.ctx||{},u=s.parents=h.parentTags=R&&O(h.parentTags,R.parentTags)||{},c&&(u[c.tagName]=c),u[s.tagName]=h.tag=s);if(!(s._er=o)){for(i(s,r[0]),s.rendering={},f=0;g>f;f++)m=s.tagCtx=r[f],k=m.props,y=s.cvtArgs(),(b=k.dataMap||C)&&(y.length||k.dataMap)&&(_=m.map,(!_||_.src!==y[0]||a)&&(_&&_.src&&_.unmap(),_=m.map=b.map(y[0],k,void 0,!s._.bnd)),y=[_.tgt]),s.ctx=m.ctx,f||(x&&(j=s.template,s.init(m,A,s.ctx),x=void 0),A&&(A.attr=s.attr=A.attr||s.attr),p=s.attr,s._.noVws=p&&p!==Ve),v=void 0,s.render&&(v=s.render.apply(s,y)),y.length||(y=[t]),void 0===v&&(v=m.render(y[0],!0)||(a?void 0:"")),T=T?T+(v||""):v;s.rendering=void 0}return s.tagCtx=r[0],s.ctx=s.tagCtx.ctx,s._.noVws&&s._.inline&&(T="text"===p?ee.html(T):""),M&&t._.onRender?t._.onRender(T,t,s):T}function b(e,t,n,r,i,a,o,s){var d,l,u,p=this,f="array"===t;p.content=s,p.views=f?[]:{},p.parent=n,p.type=t||"top",p.data=r,p.tmpl=i,u=p._={key:0,useKey:f?0:1,id:""+Ae++,onRender:o,bnds:{}},p.linked=!!o,n?(d=n.views,l=n._,l.useKey?(d[u.key="_"+l.useKey++]=p,p.index=Ee,p.getIndex=c):d.length===(u.key=p.index=a)?d.push(p):d.splice(a,0,p),p.ctx=e||n.ctx):p.ctx=e}function _(e){var t,n,r,i,a,o,s;for(t in Ue)if(a=Ue[t],(o=a.compile)&&(n=e[t+"s"]))for(r in n)i=n[r]=o(r,n[r],e,0),i._is=t,i&&(s=re.onStore[t])&&s(r,i,o)}function y(e,t,n){function i(){var t=this;t._={inline:!0,unlinked:!0},t.tagName=e}var a,o,s,d=new re._tg;if(W(t)?t={depends:t.depends,render:t}:""+t===t&&(t={template:t}),o=t.baseTag){t.flow=!!t.flow,t.baseTag=o=""+o===o?n&&n.tags[o]||ne[o]:o,d=l(d,o);for(s in t)d[s]=r(o[s],t[s])}else d=l(d,t);return void 0!==(a=d.template)&&(d.template=""+a===a?Y[a]||Y(a):a),d.init!==!1&&((i.prototype=d).constructor=d._ctr=i),n&&(d._parentTmpl=n),d}function k(e){return this.base.apply(this,e)}function j(e,n,r,i){function a(n){var a,s;if(""+n===n||n.nodeType>0&&(o=n)){if(!o)if(/^\.\/[^\\:*?"<>]*$/.test(n))(s=Y[e=e||n])?n=s:o=document.getElementById(n);else if(t.fn&&!Z.test(n))try{o=t(document).find(n)[0]}catch(d){}o&&(i?n=o.innerHTML:(a=o.getAttribute(Me),a?a!==Ne?(n=Y[a],delete Y[a]):t.fn&&(n=t.data(o)[Ne]):(e=e||(t.fn?Ne:n),n=j(e,o.innerHTML,r,i)),n.tmplName=e=e||a,e!==Ne&&(Y[e]=n),o.setAttribute(Me,e),t.fn&&t.data(o,Ne,n))),o=void 0}else n.fn||(n=void 0);return n}var o,s,d=n=n||"";return 0===i&&(i=void 0,d=a(d)),i=i||(n.markup?n:{}),i.tmplName=e,r&&(i._parentTmpl=r),!d&&n.markup&&(d=a(n.markup))&&d.fn&&(d=d.markup),void 0!==d?(d.fn||n.fn?d.fn&&(s=d):(n=T(d,i),S(d.replace(xe,"\\$&"),n)),s||(_(i),s=l(function(){return n.render.apply(n,arguments)},n)),e&&!r&&e!==Ne&&(Se[e]=s),s):void 0}function C(e){function t(t,n){this.tgt=e.getTgt(t,n)}return W(e)&&(e={getTgt:e}),e.baseMap&&(e=l(l({},e.baseMap),e)),e.map=function(e,n){return new t(e,n)},e}function T(e,n){var r,i=ae._wm||{},a=l({tmpls:[],links:{},bnds:[],_is:"template",render:V},n);return a.markup=e,n.htmlTag||(r=ye.exec(e),a.htmlTag=r?r[1].toLowerCase():""),r=i[a.htmlTag],r&&r!==i.div&&(a.markup=t.trim(a.markup)),a}function A(e,t){function n(i,a,o){var s,d,l,u;if(i&&typeof i===$e&&!i.nodeType&&!i.markup&&!i.getTgt){for(l in i)n(l,i[l],a);return G}return void 0===a&&(a=i,i=void 0),i&&""+i!==i&&(o=a,a=i,i=void 0),u=o?o[r]=o[r]||{}:n,d=t.compile,null===a?i&&delete u[i]:(a=d?d.call(u,i,a,o,0):a,i&&(u[i]=a)),d&&a&&(a._is=e),a&&(s=re.onStore[e])&&s(i,a,d),a}var r=e+"s";G[r]=n}function R(e){oe[e]=function(t){return arguments.length?(ie[e]=t,oe):ie[e]}}function V(e,t,n,r,i,a){var o,s,d,l,u,p,c,f,g=r,v="";if(t===!0?(n=t,t=void 0):typeof t!==$e&&(t=void 0),(d=this.tag)?(u=this,g=g||u.view,l=g.getTmpl(d.template||u.tmpl),arguments.length||(e=g)):l=this,l){if(!g&&e&&"view"===e._is&&(g=e),g&&e===g&&(e=g.data),p=!g,fe=fe||p,g||((t=t||{}).root=e),!fe||ae.useViews||l.useViews||g&&g!==z)v=$(l,e,t,n,g,i,a,d);else{if(g?(c=g.data,f=g.index,g.index=Ee):(g=z,g.data=e,g.ctx=t),X(e)&&!n)for(o=0,s=e.length;s>o;o++)g.index=o,g.data=e[o],v+=l.fn(e[o],g,re);else g.data=e,v+=l.fn(e,g,re);g.data=c,g.index=f}p&&(fe=void 0)}return v}function $(e,t,n,r,i,a,o,s){function d(e){_=l({},n),_[x]=e}var u,p,c,f,g,v,m,h,w,x,_,y,k="";if(s&&(w=s.tagName,y=s.tagCtx,n=n?O(n,s.ctx):s.ctx,e===i.content?m=e!==i.ctx._wrp?i.ctx._wrp:void 0:e!==y.content?e===s.template?(m=y.tmpl,n._wrp=y.content):m=y.content||i.content:m=i.content,y.props.link===!1&&(n=n||{},n.link=!1),(x=y.props.itemVar)&&("~"!==x.charAt(0)&&E("Use itemVar='~myItem'"),x=x.slice(1))),i&&(o=o||i._.onRender,n=O(n,i.ctx)),a===!0&&(v=!0,a=0),o&&(n&&n.link===!1||s&&s._.noVws)&&(o=void 0),h=o,o===!0&&(h=void 0,o=i._.onRender),n=e.helpers?O(e.helpers,n):n,_=n,X(t)&&!r)for(c=v?i:void 0!==a&&i||new b(n,"array",i,t,e,a,o),i&&i._.useKey&&(c._.bnd=!s||s._.bnd&&s),x&&(c.it=x),x=c.it,u=0,p=t.length;p>u;u++)x&&d(t[u]),f=new b(_,"item",c,t[u],e,(a||0)+u,o,m),g=e.fn(t[u],f,re),k+=c._.onRender?c._.onRender(g,f):g;else x&&d(t),c=v?i:new b(_,w||"data",i,t,e,a,o,m),s&&!s.flow&&(c.tag=s),k+=e.fn(t,c,re);return h?h(k,c):k}function M(e,t,n){var r=void 0!==n?W(n)?n.call(t.data,e,t):n||"":"{Error: "+e.message+"}";return ie.onError&&void 0!==(n=ie.onError.call(t.data,e,n&&r,t))&&(r=n),t&&!t.linkCtx?ee.html(r):r}function N(e){throw new re.Err(e)}function E(e){N("Syntax error\n"+e)}function S(e,t,n,r,i){function a(t){t-=f,t&&v.push(e.substr(f,t).replace(he,"\\n"))}function o(t,n){t&&(t+="}}",E((n?"{{"+n+"}} block has {{/"+t+" without {{"+t:"Unmatched or missing {{/"+t)+", in template:\n"+e))}function s(s,d,c,h,w,x,b,_,y,k,j,C){(b&&d||y&&!c||_&&":"===_.slice(-1)||k)&&E(s),x&&(w=":",h=Ve),y=y||n&&!i;var T=(d||n)&&[[]],A="",R="",V="",$="",M="",N="",S="",F="",U=!y&&!w;c=c||(_=_||"#data",w),a(C),f=C+s.length,b?p&&v.push(["*","\n"+_.replace(/^:/,"ret+= ").replace(we,"$1")+";\n"]):c?("else"===c&&(_e.test(_)&&E('for "{{else if expr}}" use "{{else expr}}"'),T=m[7]&&[[]],m[8]=e.substring(m[8],C),m=g.pop(),v=m[2],U=!0),_&&J(_.replace(he," "),T,t).replace(be,function(e,t,n,r,i,a,o,s){return r="'"+i+"':",o?(R+=a+",",$+="'"+s+"',"):n?(V+=r+a+",",N+=r+"'"+s+"',"):t?S+=a:("trigger"===i&&(F+=a),A+=r+a+",",M+=r+"'"+s+"',",u=u||Ce.test(i)),""}).slice(0,-1),T&&T[0]&&T.pop(),l=[c,h||!!r||u||"",U&&[],I($||(":"===c?"'#data',":""),M,N),I(R||(":"===c?"data,":""),A,V),S,F,T||0],v.push(l),U&&(g.push(m),m=l,m[8]=f)):j&&(o(j!==m[0]&&"else"!==m[0]&&j,m[0]),m[8]=e.substring(m[8],C),m=g.pop()),o(!m&&j),v=m[2]}var d,l,u,p=ie.allowCode||t&&t.allowCode||oe.allowCode===!0,c=[],f=0,g=[],v=c,m=[,,c];return p&&(t.allowCode=p),n&&(void 0!==r&&(e=e.slice(0,-r.length-2)+ue),e=se+e+ue),o(g[0]&&g[0][2].pop()[0]),e.replace(P,s),a(e.length),(f=c[c.length-1])&&o(""+f!==f&&+f[8]===f[8]&&f[0]),n?(d=K(c,e,n),F(d,[c[0][7]])):d=K(c,t),d}function F(e,t){var n,r,i=0,a=t.length;for(e.deps=[];a>i;i++){r=t[i];for(n in r)"_jsvto"!==n&&r[n].length&&(e.deps=e.deps.concat(r[n]))}e.paths=r}function I(e,t,n){return[e.slice(0,-1),t.slice(0,-1),n.slice(0,-1)]}function U(e,t){return"\n "+(t?t+":{":"")+"args:["+e[0]+"]"+(e[1]||!t?",\n props:{"+e[1]+"}":"")+(e[2]?",\n ctx:{"+e[2]+"}":"")}function J(e,t,n){function r(r,h,w,x,b,_,y,k,j,C,T,A,R,V,$,M,N,F,I,U){function J(e,n,r,o,s,d,p,c){var f="."===r;if(r&&(b=b.slice(n.length),/^\.?constructor$/.test(c||b)&&E(e),f||(e=(o?'view.hlp("'+o+'")':s?"view":"data")+(c?(d?"."+d:o?"":s?"":"."+r)+(p||""):(c=o?"":s?d||"":r,"")),e+=c?"."+c:"",e=n+("view.data"===e.slice(0,9)?e.slice(5):e)),l)){if(q="linkTo"===i?a=t._jsvto=t._jsvto||[]:u.bd,B=f&&q[q.length-1]){if(B._jsv){for(;B.sb;)B=B.sb;B.bnd&&(b="^"+b.slice(1)),B.sb=b,B.bnd=B.bnd||"^"===b.charAt(0)}}else q.push(b);m[g]=I+(f?1:0)}return e}x=l&&x,x&&!k&&(b=x+b),_=_||"",w=w||h||A,b=b||j,C=C||N||"";var K,O,q,B,L;if(!y||d||s){if(l&&M&&!d&&!s&&(!i||o||a)&&(K=m[g-1],U.length-1>I-(K||0))){if(K=U.slice(K,I+r.length),O!==!0)if(q=a||p[g-1].bd,B=q[q.length-1],B&&B.prm){for(;B.sb&&B.sb.prm;)B=B.sb;L=B.sb={path:B.sb,bnd:B.bnd}}else q.push(L={path:q.pop()});M=de+":"+K+" onerror=''"+le,O=f[M],O||(f[M]=!0,f[M]=O=S(M,n,!0)),O!==!0&&L&&(L._jsv=O,L.prm=u.bd,L.bnd=L.bnd||L.path&&L.path.indexOf("^")>=0)}return d?(d=!R,d?r:A+'"'):s?(s=!V,s?r:A+'"'):(w?(m[g]=I++,u=p[++g]={bd:[]},w):"")+(F?g?"":(c=U.slice(c,I),(i?(i=o=a=!1,"\b"):"\b,")+c+(c=I+r.length,l&&t.push(u.bd=[]),"\b")):k?(g&&E(e),l&&t.pop(),i=b,o=x,c=I+r.length,x&&(l=u.bd=t[i]=[]),b+":"):b?b.split("^").join(".").replace(ve,J)+(C?(u=p[++g]={bd:[]},v[g]=!0,C):_):_?_:$?(v[g]=!1,u=p[--g],$+(C?(u=p[++g],v[g]=!0,C):"")):T?(v[g]||E(e),","):h?"":(d=R,s=V,'"'))}E(e)}var i,a,o,s,d,l=t&&t[0],u={bd:l},p={0:u},c=0,f=n?n.links:l&&(l.links=l.links||{}),g=0,v={},m={},h=(e+(n?" ":"")).replace(me,r);return!g&&h||E(e)}function K(e,t,n){var r,i,a,o,s,d,l,u,p,c,f,g,v,m,h,w,x,b,_,y,k,j,C,A,R,V,$,M,N,S,I=0,J=ae.useViews||t.useViews||t.tags||t.templates||t.helpers||t.converters,O="",q={},B=e.length;for(""+t===t?(b=n?'data-link="'+t.replace(he," ").slice(1,-1)+'"':t,t=0):(b=t.tmplName||"unnamed",t.allowCode&&(q.allowCode=!0),t.debug&&(q.debug=!0),f=t.bnds,x=t.tmpls),r=0;B>r;r++)if(i=e[r],""+i===i)O+='\n+"'+i+'"';else if(a=i[0],"*"===a)O+=";\n"+i[1]+"\nret=ret";else{if(o=i[1],k=!n&&i[2],s=U(i[3],"params")+"},"+U(v=i[4]),M=i[5],S=i[6],j=i[8]&&i[8].replace(we,"$1"),(R="else"===a)?g&&g.push(i[7]):(I=0,f&&(g=i[7])&&(g=[g],I=f.push(1))),J=J||v[1]||v[2]||g||/view.(?!index)/.test(v[0]),(V=":"===a)?(o&&(a=o===Ve?">":o+a),S=i[6]||ie.trigger):(k&&(_=T(j,q),_.tmplName=b+"/"+a,_.useViews=_.useViews||J,K(k,_),J=_.useViews,x.push(_)),R||(y=a,J=J||a&&(!ne[a]||!ne[a].flow),A=O,O=""),C=e[r+1],C=C&&"else"===C[0]),N=M?";\ntry{\nret+=":"\n+",m="",h="",V&&(g||S||o&&o!==Ve)){if($="return {"+s+"};",w='c("'+o+'",view,',$=new Function("data,view,j,u"," // "+b+" "+I+" "+a+"\n"+$),$._er=M,m=w+I+",",h=")",$._tag=a,n)return $;F($,g),c=!0}if(O+=V?(n?(M?"\ntry{\n":"")+"return ":N)+(c?(c=void 0,J=p=!0,w+(g?(f[I-1]=$,I):"{"+s+"}")+")"):">"===a?(l=!0,"h("+v[0]+")"):(u=!0,"((v="+v[0]+')!=null?v:"")')):(d=!0,"\n{view:view,tmpl:"+(k?x.length:"0")+","+s+"},"),y&&!C){if(O="["+O.slice(0,-1)+"]",w='t("'+y+'",view,this,',n||g){if(O=new Function("data,view,j,u"," // "+b+" "+I+" "+y+"\nreturn "+O+";"),O._er=M,O._tag=y,g&&F(f[I-1]=O,g),n)return O;m=w+I+",undefined,",h=")"}O=A+N+w+(I||O)+")",g=0,y=0}M&&(J=!0,O+=";\n}catch(e){ret"+(n?"urn ":"+=")+m+"j._err(e,view,"+M+")"+h+";}\n"+(n?"":"ret=ret"))}O="// "+b+"\nvar v"+(d?",t=j._tag":"")+(p?",c=j._cnvt":"")+(l?",h=j._html":"")+(n?";\n":',ret=""\n')+(q.debug?"debugger;":"")+O+(n?"\n":";\nreturn ret;"),ie.debugMode!==!1&&(O="try {\n"+O+"\n}catch(e){\nreturn j._err(e, view);\n}");try{O=new Function("data,view,j,u",O)}catch(L){E("Compiled template code:\n\n"+O+'\n: "'+L.message+'"')}return t&&(t.fn=O,t.useViews=!!J),O}function O(e,t){return e&&e!==t?t?l(l({},t),e):e:t&&l({},t)}function q(e){return Re[e]||(Re[e]="&#"+e.charCodeAt(0)+";")}function B(e){var t,n,r=[];if(typeof e===$e)for(t in e)n=e[t],n&&n.toJSON&&!n.toJSON()||W(n)||r.push({key:t,prop:n});return r}function L(e,n,r){var i=this.jquery&&(this[0]||N('Unknown template: "'+this.selector+'"')),a=i.getAttribute(Me);return V.call(a?t.data(i)[Ne]:Y(i),e,n,r)}function Q(e){return void 0!=e?je.test(e)&&(""+e).replace(Te,q)||e:""}var H=t===!1;t=t&&t.fn?t:e.jQuery;var D,P,Z,z,G,W,X,Y,ee,te,ne,re,ie,ae,oe,se,de,le,ue,pe,ce,fe,ge="v0.9.75",ve=/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,me=/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(!*?[#~]?[\w$.^]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=\s*[.^]|\s*$|[^([])|[)\]])([([]?))|(\s+)/g,he=/[ \t]*(\r\n|\n|\r)/g,we=/\\(['"])/g,xe=/['"\\]/g,be=/(?:\x08|^)(onerror:)?(?:(~?)(([\w$_\.]+):)?([^\x08]+))\x08(,)?([^\x08]+)/gi,_e=/^if\s/,ye=/<(\w+)[>\s]/,ke=/[\x00`><"'&]/g,je=/[\x00`><\"'&]/,Ce=/^on[A-Z]|^convert(Back)?$/,Te=ke,Ae=0,Re={"&":"&","<":"<",">":">","\x00":"�","'":"'",'"':""","`":"`"},Ve="html",$e="object",Me="data-jsv-tmpl",Ne="jsvTmpl",Ee="For #index in nested block use #getIndex().",Se={},Fe=e.jsrender,Ie=Fe&&t&&!t.render,Ue={template:{compile:j},tag:{compile:y},helper:{},converter:{}};if(G={jsviews:ge,sub:{View:b,Err:d,tmplFn:S,parse:J,extend:l,extendCtx:O,syntaxErr:E,onStore:{},addSetting:R,settings:{allowCode:!1},advSet:o,_ths:i,_tg:function(){},_cnvt:m,_tag:x,_er:N,_err:M,_html:Q},settings:{delimiters:u,advanced:function(e){return e?(l(ae,e),re.advSet(),oe):ae}},map:C},(d.prototype=new Error).constructor=d,c.depends=function(){return[this.get("item"),"index"]},f.depends="index",b.prototype={get:p,getIndex:f,getRsc:w,getTmpl:v,hlp:g,_is:"view"},!(Fe||t&&t.render)){for(D in Ue)A(D,Ue[D]);Y=G.templates,ee=G.converters,te=G.helpers,ne=G.tags,re=G.sub,oe=G.settings,re._tg.prototype={baseApply:k,cvtArgs:h},z=re.topView=new b,t?(t.fn.render=L,t.observable&&(l(re,t.views.sub),G.map=t.views.map)):(t={},H&&(e.jsrender=t),t.renderFile=t.__express=t.compile=function(){throw"Node.js: use npm jsrender, or jsrender-node.js"},t.isFunction=function(e){return"function"==typeof e},t.isArray=Array.isArray||function(e){return"[object Array]"==={}.toString.call(e)},re._jq=function(e){e!==t&&(l(e,t),t=e,t.fn.render=L,delete t.jsrender)},t.jsrender=ge),ie=re.settings,ie.allowCode=!1,W=t.isFunction,X=t.isArray,t.render=Se,t.views=G,t.templates=Y=G.templates;for(ce in ie)R(ce);(oe.debugMode=function(e){return void 0===e?ie.debugMode:(ie.debugMode=e,ie.onError=e+""===e?new Function("","return '"+e+"';"):W(e)?e:void 0,oe)})(!1),ae=ie.advanced={useViews:!1,_jsv:!1},ne({"if":{render:function(e){var t=this,n=t.tagCtx,r=t.rendering.done||!e&&(arguments.length||!n.index)?"":(t.rendering.done=!0,t.selected=n.index,n.render(n.view,!0));return r},flow:!0},"for":{render:function(e){var t,n=!arguments.length,r=this,i=r.tagCtx,a="",o=0;return r.rendering.done||(t=n?i.view.data:e,void 0!==t&&(a+=i.render(t,n),o+=X(t)?t.length:1),(r.rendering.done=o)&&(r.selected=i.index)),a},flow:!0},props:{baseTag:"for",dataMap:C(B),flow:!0},include:{flow:!0},"*":{render:a,flow:!0},":*":{render:a,flow:!0},dbg:te.dbg=ee.dbg=s}),ee({html:Q,attr:Q,url:function(e){return void 0!=e?encodeURI(""+e):null===e?e:""}}),oe.delimiters("{{","}}","^")}return Ie&&Fe.views.sub._jq(t),t||Fe},window); -//# sourceMappingURL=jsrender.min.js.map \ No newline at end of file +!function(e,t){var n=t.jQuery;"object"==typeof exports?module.exports=n?e(t,n):function(n){if(n&&!n.fn)throw"Provide jQuery or null";return e(t,n)}:"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t,!1)}(function(e,t){"use strict";function n(e,t){return function(){var n,r=this,i=r.base;return r.base=e,n=t.apply(r,arguments),r.base=i,n}}function r(e,t){return ee(t)&&(t=n(e?e._d?e:n(s,e):s,t),t._d=1),t}function i(e,t){for(var n in t.props)Ve.test(n)&&(e[n]=r(e[n],t.props[n]))}function o(e){return e}function s(){return""}function a(e){try{throw console.log("JsRender dbg breakpoint: "+e),"dbg breakpoint"}catch(t){}return this.base?this.baseApply(arguments):e}function d(e){this.name=(t.link?"JsViews":"JsRender")+" Error",this.message=e||this.name}function u(e,t){for(var n in t)e[n]=t[n];return e}function l(e,t,n){return e?(ae.delimiters=[e,t,ge=n?n.charAt(0):ge],le=e.charAt(0),pe=e.charAt(1),ce=t.charAt(0),fe=t.charAt(1),e="\\"+le+"(\\"+ge+")?\\"+pe,t="\\"+ce+"\\"+fe,G="(?:(\\w+(?=[\\/\\s\\"+ce+"]))|(\\w+)?(:)|(>)|(\\*))\\s*((?:[^\\"+ce+"]|\\"+ce+"(?!\\"+fe+"))*?)",se.rTag="(?:"+G+")",G=new RegExp("(?:"+e+G+"(\\/)?|\\"+le+"(\\"+ge+")?\\"+pe+"(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))"+t,"g"),W=new RegExp("<.*>|([^\\\\]|^)[{}]|"+e+".*"+t),ue):ae.delimiters}function p(e,t){t||e===!0||(t=e,e=void 0);var n,r,i,o,s=this,a=!t||"root"===t;if(e){if(o=t&&s.type===t&&s,!o)if(n=s.views,s._.useKey){for(r in n)if(o=t?n[r].get(e,t):n[r])break}else for(r=0,i=n.length;!o&&i>r;r++)o=t?n[r].get(e,t):n[r]}else if(a)for(;s.parent;)o=s,s=s.parent;else for(;s&&!o;)o=s.type===t?s:void 0,s=s.parent;return o}function c(){var e=this.get("item");return e?e.index:void 0}function f(){return this.index}function g(t){var n,r=this,i=r.linkCtx,o=(r.ctx||{})[t];return void 0===o&&i&&i.ctx&&(o=i.ctx[t]),void 0===o&&(o=ie[t]),o&&ee(o)&&!o._wrp&&(n=function(){return o.apply(this&&this!==e?this:r,arguments)},n._wrp=r,u(n,o)),n||o}function v(e){return e&&(e.fn?e:this.getRsc("templates",e)||ne(e))}function h(e,t,n,r){var o,s,a="number"==typeof n&&t.tmpl.bnds[n-1],d=t.linkCtx;return void 0!==r?n=r={props:{},args:[r]}:a&&(n=a(t.data,t,se)),s=n.args[0],(e||a)&&(o=d&&d.tag,o||(o=u(new se._tg,{_:{inline:!d,bnd:a,unlinked:!0},tagName:":",cvt:e,flow:!0,tagCtx:n}),d&&(d.tag=o,o.linkCtx=d),n.ctx=L(n.ctx,(d?d.view:t).ctx)),o._er=r&&s,i(o,n),n.view=t,o.ctx=n.ctx||{},n.ctx=void 0,s=o.cvtArgs(o.convert||"true"!==e&&e)[0],s=a&&t._.onRender?t._.onRender(s,t,o):s),void 0!=s?s:""}function m(e){var t=this,n=t.tagCtx,r=n.view,i=n.args;return e=t.convert||e,e=e&&(""+e===e?r.getRsc("converters",e)||F("Unknown converter: '"+e+"'"):e),i=i.length||n.index?e?i.slice():i:[r.data],e&&(e.depends&&(t.depends=se.getDeps(t.depends,t,e.depends,e)),i[0]=e.apply(t,i)),i}function w(e,t){for(var n,r,i=this;void 0===n&&i;)r=i.tmpl&&i.tmpl[e],n=r&&r[t],i=i.parent;return n||Y[e][t]}function x(e,t,n,r,o,s){t=t||X;var a,d,u,l,p,c,f,g,v,h,m,w,x,b,_,y,k,j,C,A="",T=t.linkCtx||0,V=t.ctx,R=n||t.tmpl,M="number"==typeof r&&t.tmpl.bnds[r-1];for("tag"===e._is?(a=e,e=a.tagName,r=a.tagCtxs,u=a.template):(d=t.getRsc("tags",e)||F("Unknown tag: {{"+e+"}} "),u=d.template),void 0!==s?(A+=s,r=s=[{props:{},args:[]}]):M&&(r=M(t.data,t,se)),g=r.length,f=0;g>f;f++)h=r[f],(!T||!T.tag||f&&!T.tag._.inline||a._er)&&((w=R.tmpls&&h.tmpl)&&(w=h.content=R.tmpls[w-1]),h.index=f,h.tmpl=w,h.render=N,h.view=t,h.ctx=L(h.ctx,V)),(n=h.props.tmpl)&&(h.tmpl=t.getTmpl(n)),a||(a=new d._ctr,x=!!a.init,a.parent=c=V&&V.tag,a.tagCtxs=r,C=a.dataMap,T&&(a._.inline=!1,T.tag=a,a.linkCtx=T),(a._.bnd=M||T.fn)?a._.arrVws={}:a.dataBoundOnly&&F("{^{"+e+"}} tag must be data-bound")),r=a.tagCtxs,C=a.dataMap,h.tag=a,C&&r&&(h.map=r[f].map),a.flow||(m=h.ctx=h.ctx||{},l=a.parents=m.parentTags=V&&L(m.parentTags,V.parentTags)||{},c&&(l[c.tagName]=c),l[a.tagName]=m.tag=a);if(!(a._er=s)){for(i(a,r[0]),a.rendering={},f=0;g>f;f++)h=a.tagCtx=r[f],k=h.props,y=a.cvtArgs(),(b=k.dataMap||C)&&(y.length||k.dataMap)&&(_=h.map,_&&_.src===y[0]&&!o||(_&&_.src&&_.unmap(),_=h.map=b.map(y[0],k,void 0,!a._.bnd)),y=[_.tgt]),a.ctx=h.ctx,f||(x&&(j=a.template,a.init(h,T,a.ctx),x=void 0),T&&(T.attr=a.attr=T.attr||a.attr),p=a.attr,a._.noVws=p&&p!==Ne),v=void 0,a.render&&(v=a.render.apply(a,y)),y.length||(y=[t]),void 0===v&&(v=h.render(y[0],!0)||(o?void 0:"")),A=A?A+(v||""):v;a.rendering=void 0}return a.tagCtx=r[0],a.ctx=a.tagCtx.ctx,a._.noVws&&a._.inline&&(A="text"===p?re.html(A):""),M&&t._.onRender?t._.onRender(A,t,a):A}function b(e,t,n,r,i,o,s,a){var d,u,l,p=this,f="array"===t;p.content=a,p.views=f?[]:{},p.parent=n,p.type=t||"top",p.data=r,p.tmpl=i,l=p._={key:0,useKey:f?0:1,id:""+Me++,onRender:s,bnds:{}},p.linked=!!s,n?(d=n.views,u=n._,u.useKey?(d[l.key="_"+u.useKey++]=p,p.index=Je,p.getIndex=c):d.length===(l.key=p.index=o)?d.push(p):d.splice(o,0,p),p.ctx=e||n.ctx):p.ctx=e}function _(e){var t,n,r,i,o,s,a;for(t in qe)if(o=qe[t],(s=o.compile)&&(n=e[t+"s"]))for(r in n)i=n[r]=s(r,n[r],e,0),i._is=t,i&&(a=se.onStore[t])&&a(r,i,s)}function y(e,t,n){function i(){var t=this;t._={inline:!0,unlinked:!0},t.tagName=e}var o,s,a,d=new se._tg;if(ee(t)?t={depends:t.depends,render:t}:""+t===t&&(t={template:t}),s=t.baseTag){t.flow=!!t.flow,t.baseTag=s=""+s===s?n&&n.tags[s]||oe[s]:s,d=u(d,s);for(a in t)d[a]=r(s[a],t[a])}else d=u(d,t);return void 0!==(o=d.template)&&(d.template=""+o===o?ne[o]||ne(o):o),d.init!==!1&&((i.prototype=d).constructor=d._ctr=i),n&&(d._parentTmpl=n),d}function k(e){return this.base.apply(this,e)}function j(e,n,r,i){function o(n){var o,a;if(""+n===n||n.nodeType>0&&(s=n)){if(!s)if(/^\.\/[^\\:*?"<>]*$/.test(n))(a=ne[e=e||n])?n=a:s=document.getElementById(n);else if(t.fn&&!W.test(n))try{s=t(document).find(n)[0]}catch(d){}s&&(i?n=s.innerHTML:(o=s.getAttribute(Ee),o?o!==Fe?(n=ne[o],delete ne[o]):t.fn&&(n=t.data(s)[Fe]):(e=e||(t.fn?Fe:n),n=j(e,s.innerHTML,r,i)),n.tmplName=e=e||o,e!==Fe&&(ne[e]=n),s.setAttribute(Ee,e),t.fn&&t.data(s,Fe,n))),s=void 0}else n.fn||(n=void 0);return n}var s,a,d=n=n||"";return 0===i&&(i=void 0,d=o(d)),i=i||(n.markup?n:{}),i.tmplName=e,r&&(i._parentTmpl=r),!d&&n.markup&&(d=o(n.markup))&&d.fn&&(d=d.markup),void 0!==d?(d.fn||n.fn?d.fn&&(a=d):(n=V(d,i),I(d.replace(ye,"\\$&"),n)),a||(_(i),a=u(function(){return n.render.apply(n,arguments)},n)),e&&!r&&e!==Fe&&(Ie[e]=a),a):void 0}function C(e,n){return t.isFunction(e)?e.call(n):e}function A(e){var t,n=[],r=e.length;for(t=0;r>t;t++)n.push(e[t].unmap());return n}function T(e,n){function r(e){l.apply(this,e)}function i(){return new r(arguments)}function o(e,t){var n,r,i,o,s,a=c.length;for(n=0;a>n;n++)o=c[n],r=void 0,o+""!==o&&(r=o,o=r.getter),void 0===(s=e[o])&&r&&void 0!==(i=r.defaultVal)&&(s=C(i,e)),t(s,r&&p[r.type],o)}function s(n){n=n+""===n?JSON.parse(n):n;var r,i,s,u=n,l=[];if(t.isArray(n)){for(n=n||[],i=n.length,r=0;i>r;r++)l.push(this.map(n[r]));return l._is=e,l.unmap=d,l.merge=a,l}if(n){o(n,function(e,t){t&&(e=t.map(e)),l.push(e)}),u=this.apply(this,l);for(s in n)b[s]||(u[s]=n[s])}return u}function a(e){e=e+""===e?JSON.parse(e):e;var n,r,s,a,d,u,l,p,c,f,v=this;if(t.isArray(v)){for(p={},f=[],s=e.length,a=v.length,n=0;s>n;n++){for(c=e[n],l=!1,r=0;a>r&&!l;r++)p[r]||(u=v[r],g&&(p[r]=l=g+""===g?c[g]&&(b[g]?u[g]():u[g])===c[g]:g(u,c)));l?(u.merge(c),f.push(u)):f.push(i.map(c))}return void(x?x(v).refresh(f):v.splice.apply(v,[0,v.length].concat(f)))}o(e,function(e,t,n){t?v[n]().merge(e):v[n](e)});for(d in e)b[d]||(v[d]=e[d])}function d(){var e,n,r,i,o,s,a=this;if(t.isArray(a))return A(a);for(e={},i=c.length,r=0;i>r;r++)n=c[r],o=void 0,n+""!==n&&(o=n,n=o.getter),s=a[n](),e[n]=o&&s&&p[o.type]?t.isArray(s)?A(s):s.unmap():s;for(n in a)"_is"===n||b[n]||"_"===n.charAt(0)&&b[n.slice(1)]||t.isFunction(a[n])||(e[n]=a[n]);return e}var u,l,p=this,c=n.getters,f=n.extend,g=n.id,v=t.extend({_is:e||"unnamed",unmap:d,merge:a},f),h="",m="",w=c?c.length:0,x=t.observable,b={};for(r.prototype=v,u=0;w>u;u++)!function(e){e=e.getter||e,b[e]=u+1;var t="_"+e;h+=(h?",":"")+e,m+="this."+t+" = "+e+";\n",v[e]=v[e]||function(n){return arguments.length?void(x?x(this).setProperty(e,n):this[t]=n):this[t]},x&&(v[e].set=v[e].set||function(e){this[t]=e})}(c[u]);return l=new Function(h,m.slice(0,-1)),l.prototype=v,v.constructor=l,i.map=s,i.getters=c,i.extend=f,i.id=g,i}function V(e,n){var r,i=de._wm||{},o=u({tmpls:[],links:{},bnds:[],_is:"template",render:N},n);return o.markup=e,n.htmlTag||(r=Ce.exec(e),o.htmlTag=r?r[1].toLowerCase():""),r=i[o.htmlTag],r&&r!==i.div&&(o.markup=t.trim(o.markup)),o}function R(e,t){function n(i,o,s){var a,d,u,l;if(i&&typeof i===Se&&!i.nodeType&&!i.markup&&!i.getTgt&&!("viewModel"===e&&i.getters||i.extend)){for(u in i)n(u,i[u],o);return o||Y}return void 0===o&&(o=i,i=void 0),i&&""+i!==i&&(s=o,o=i,i=void 0),l=s?"viewModel"===e?s:s[r]=s[r]||{}:n,d=t.compile,null===o?i&&delete l[i]:(o=d?d.call(l,i,o,s,0):o,i&&(l[i]=o)),d&&o&&(o._is=e),o&&(a=se.onStore[e])&&a(i,o,d),o}var r=e+"s";Y[r]=n}function M(e){ue[e]=function(t){return arguments.length?(ae[e]=t,ue):ae[e]}}function $(e){function t(t,n){this.tgt=e.getTgt(t,n)}return ee(e)&&(e={getTgt:e}),e.baseMap&&(e=u(u({},e.baseMap),e)),e.map=function(e,n){return new t(e,n)},e}function N(e,t,n,r,i,o){var s,a,d,u,l,p,c,f,g=r,v="";if(t===!0?(n=t,t=void 0):typeof t!==Se&&(t=void 0),(d=this.tag)?(l=this,g=g||l.view,u=g.getTmpl(d.template||l.tmpl),arguments.length||(e=g)):u=this,u){if(!g&&e&&"view"===e._is&&(g=e),g&&e===g&&(e=g.data),p=!g,he=he||p,g||((t=t||{}).root=e),!he||de.useViews||u.useViews||g&&g!==X)v=S(u,e,t,n,g,i,o,d);else{if(g?(c=g.data,f=g.index,g.index=Je):(g=X,g.data=e,g.ctx=t),te(e)&&!n)for(s=0,a=e.length;a>s;s++)g.index=s,g.data=e[s],v+=u.fn(e[s],g,se);else g.data=e,v+=u.fn(e,g,se);g.data=c,g.index=f}p&&(he=void 0)}return v}function S(e,t,n,r,i,o,s,a){function d(e){_=u({},n),_[x]=e}var l,p,c,f,g,v,h,m,w,x,_,y,k="";if(a&&(w=a.tagName,y=a.tagCtx,n=n?L(n,a.ctx):a.ctx,e===i.content?h=e!==i.ctx._wrp?i.ctx._wrp:void 0:e!==y.content?e===a.template?(h=y.tmpl,n._wrp=y.content):h=y.content||i.content:h=i.content,y.props.link===!1&&(n=n||{},n.link=!1),(x=y.props.itemVar)&&("~"!==x.charAt(0)&&J("Use itemVar='~myItem'"),x=x.slice(1))),i&&(s=s||i._.onRender,n=L(n,i.ctx)),o===!0&&(v=!0,o=0),s&&(n&&n.link===!1||a&&a._.noVws)&&(s=void 0),m=s,s===!0&&(m=void 0,s=i._.onRender),n=e.helpers?L(e.helpers,n):n,_=n,te(t)&&!r)for(c=v?i:void 0!==o&&i||new b(n,"array",i,t,e,o,s),i&&i._.useKey&&(c._.bnd=!a||a._.bnd&&a),x&&(c.it=x),x=c.it,l=0,p=t.length;p>l;l++)x&&d(t[l]),f=new b(_,"item",c,t[l],e,(o||0)+l,s,h),g=e.fn(t[l],f,se),k+=c._.onRender?c._.onRender(g,f):g;else x&&d(t),c=v?i:new b(_,w||"data",i,t,e,o,s,h),a&&!a.flow&&(c.tag=a),k+=e.fn(t,c,se);return m?m(k,c):k}function E(e,t,n){var r=void 0!==n?ee(n)?n.call(t.data,e,t):n||"":"{Error: "+e.message+"}";return ae.onError&&void 0!==(n=ae.onError.call(t.data,e,n&&r,t))&&(r=n),t&&!t.linkCtx?re.html(r):r}function F(e){throw new se.Err(e)}function J(e){F("Syntax error\n"+e)}function I(e,t,n,r,i){function o(t){t-=f,t&&v.push(e.substr(f,t).replace(be,"\\n"))}function s(t,n){t&&(t+="}}",J((n?"{{"+n+"}} block has {{/"+t+" without {{"+t:"Unmatched or missing {{/"+t)+", in template:\n"+e))}function a(a,d,c,m,w,x,b,_,y,k,j,C){(b&&d||y&&!c||_&&":"===_.slice(-1)||k)&&J(a),x&&(w=":",m=Ne),y=y||n&&!i;var A=(d||n)&&[[]],T="",V="",R="",M="",$="",N="",S="",E="",F=!y&&!w;c=c||(_=_||"#data",w),o(C),f=C+a.length,b?p&&v.push(["*","\n"+_.replace(/^:/,"ret+= ").replace(_e,"$1")+";\n"]):c?("else"===c&&(je.test(_)&&J('for "{{else if expr}}" use "{{else expr}}"'),A=h[7]&&[[]],h[8]=e.substring(h[8],C),h=g.pop(),v=h[2],F=!0),_&&K(_.replace(be," "),A,t).replace(ke,function(e,t,n,r,i,o,s,a){return r="'"+i+"':",s?(V+=o+",",M+="'"+a+"',"):n?(R+=r+o+",",N+=r+"'"+a+"',"):t?S+=o:("trigger"===i&&(E+=o),T+=r+o+",",$+=r+"'"+a+"',",l=l||Ve.test(i)),""}).slice(0,-1),A&&A[0]&&A.pop(),u=[c,m||!!r||l||"",F&&[],U(M||(":"===c?"'#data',":""),$,N),U(V||(":"===c?"data,":""),T,R),S,E,A||0],v.push(u),F&&(g.push(h),h=u,h[8]=f)):j&&(s(j!==h[0]&&"else"!==h[0]&&j,h[0]),h[8]=e.substring(h[8],C),h=g.pop()),s(!h&&j),v=h[2]}var d,u,l,p=ae.allowCode||t&&t.allowCode||ue.allowCode===!0,c=[],f=0,g=[],v=c,h=[,,c];return p&&(t.allowCode=p),n&&(void 0!==r&&(e=e.slice(0,-r.length-2)+fe),e=le+e+fe),s(g[0]&&g[0][2].pop()[0]),e.replace(G,a),o(e.length),(f=c[c.length-1])&&s(""+f!==f&&+f[8]===f[8]&&f[0]),n?(d=B(c,e,n),O(d,[c[0][7]])):d=B(c,t),d}function O(e,t){var n,r,i=0,o=t.length;for(e.deps=[];o>i;i++){r=t[i];for(n in r)"_jsvto"!==n&&r[n].length&&(e.deps=e.deps.concat(r[n]))}e.paths=r}function U(e,t,n){return[e.slice(0,-1),t.slice(0,-1),n.slice(0,-1)]}function q(e,t){return"\n "+(t?t+":{":"")+"args:["+e[0]+"]"+(e[1]||!t?",\n props:{"+e[1]+"}":"")+(e[2]?",\n ctx:{"+e[2]+"}":"")}function K(e,t,n){function r(r,m,w,x,b,_,y,k,j,C,A,T,V,R,M,$,N,S,E,F){function O(e,n,r,s,a,d,p,c){var f="."===r;if(r&&(b=b.slice(n.length),/^\.?constructor$/.test(c||b)&&J(e),f||(e=(s?'view.hlp("'+s+'")':a?"view":"data")+(c?(d?"."+d:s?"":a?"":"."+r)+(p||""):(c=s?"":a?d||"":r,"")),e+=c?"."+c:"",e=n+("view.data"===e.slice(0,9)?e.slice(5):e)),u)){if(K="linkTo"===i?o=t._jsvto=t._jsvto||[]:l.bd,B=f&&K[K.length-1]){if(B._jsv){for(;B.sb;)B=B.sb;B.bnd&&(b="^"+b.slice(1)),B.sb=b,B.bnd=B.bnd||"^"===b.charAt(0)}}else K.push(b);h[g]=E+(f?1:0)}return e}x=u&&x,x&&!k&&(b=x+b),_=_||"",w=w||m||T,b=b||j,C=C||N||"";var U,q,K,B,L,Q=")";if("["===C&&(C="[j._sq(",Q=")]"),!y||d||a){if(u&&$&&!d&&!a&&(!i||s||o)&&(U=h[g-1],F.length-1>E-(U||0))){if(U=F.slice(U,E+r.length),q!==!0)if(K=o||p[g-1].bd,B=K[K.length-1],B&&B.prm){for(;B.sb&&B.sb.prm;)B=B.sb;L=B.sb={path:B.sb,bnd:B.bnd}}else K.push(L={path:K.pop()});$=pe+":"+U+" onerror=''"+ce,q=f[$],q||(f[$]=!0,f[$]=q=I($,n,!0)),q!==!0&&L&&(L._jsv=q,L.prm=l.bd,L.bnd=L.bnd||L.path&&L.path.indexOf("^")>=0)}return d?(d=!V,d?r:T+'"'):a?(a=!R,a?r:T+'"'):(w?(h[g]=E++,l=p[++g]={bd:[]},w):"")+(S?g?"":(c=F.slice(c,E),(i?(i=s=o=!1,"\b"):"\b,")+c+(c=E+r.length,u&&t.push(l.bd=[]),"\b")):k?(g&&J(e),u&&t.pop(),i=b,s=x,c=E+r.length,x&&(u=l.bd=t[i]=[]),b+":"):b?b.split("^").join(".").replace(we,O)+(C?(l=p[++g]={bd:[]},v[g]=Q,C):_):_?_:M?(M=v[g]||M,v[g]=!1,l=p[--g],M+(C?(l=p[++g],v[g]=Q,C):"")):A?(v[g]||J(e),","):m?"":(d=V,a=R,'"'))}J(e)}var i,o,s,a,d,u=t&&t[0],l={bd:u},p={0:l},c=0,f=n?n.links:u&&(u.links=u.links||{}),g=0,v={},h={},m=(e+(n?" ":"")).replace(xe,r);return!g&&m||J(e)}function B(e,t,n){var r,i,o,s,a,d,u,l,p,c,f,g,v,h,m,w,x,b,_,y,k,j,C,A,T,R,M,$,N,S,E=0,F=de.useViews||t.useViews||t.tags||t.templates||t.helpers||t.converters,I="",U={},K=e.length;for(""+t===t?(b=n?'data-link="'+t.replace(be," ").slice(1,-1)+'"':t,t=0):(b=t.tmplName||"unnamed",t.allowCode&&(U.allowCode=!0),t.debug&&(U.debug=!0),f=t.bnds,x=t.tmpls),r=0;K>r;r++)if(i=e[r],""+i===i)I+='\n+"'+i+'"';else if(o=i[0],"*"===o)I+=";\n"+i[1]+"\nret=ret";else{if(s=i[1],k=!n&&i[2],a=q(i[3],"params")+"},"+q(v=i[4]),$=i[5],S=i[6],j=i[8]&&i[8].replace(_e,"$1"),(T="else"===o)?g&&g.push(i[7]):(E=0,f&&(g=i[7])&&(g=[g],E=f.push(1))),F=F||v[1]||v[2]||g||/view.(?!index)/.test(v[0]),(R=":"===o)?s&&(o=s===Ne?">":s+o):(k&&(_=V(j,U),_.tmplName=b+"/"+o,_.useViews=_.useViews||F,B(k,_),F=_.useViews,x.push(_)),T||(y=o,F=F||o&&(!oe[o]||!oe[o].flow),A=I,I=""),C=e[r+1],C=C&&"else"===C[0]),N=$?";\ntry{\nret+=":"\n+",h="",m="",R&&(g||S||s&&s!==Ne)){if(M=new Function("data,view,j,u"," // "+b+" "+E+" "+o+"\nreturn {"+a+"};"),M._er=$,M._tag=o,n)return M;O(M,g),w='c("'+s+'",view,',c=!0,h=w+E+",",m=")"}if(I+=R?(n?($?"try{\n":"")+"return ":N)+(c?(c=void 0,F=p=!0,w+(g?(f[E-1]=M,E):"{"+a+"}")+")"):">"===o?(u=!0,"h("+v[0]+")"):(l=!0,"((v="+v[0]+')!=null?v:"")')):(d=!0,"\n{view:view,tmpl:"+(k?x.length:"0")+","+a+"},"),y&&!C){if(I="["+I.slice(0,-1)+"]",w='t("'+y+'",view,this,',n||g){if(I=new Function("data,view,j,u"," // "+b+" "+E+" "+y+"\nreturn "+I+";"),I._er=$,I._tag=y,g&&O(f[E-1]=I,g),n)return I;h=w+E+",undefined,",m=")"}I=A+N+w+(E||I)+")",g=0,y=0}$&&(F=!0,I+=";\n}catch(e){ret"+(n?"urn ":"+=")+h+"j._err(e,view,"+$+")"+m+";}"+(n?"":"ret=ret"))}I="// "+b+"\nvar v"+(d?",t=j._tag":"")+(p?",c=j._cnvt":"")+(u?",h=j._html":"")+(n?";\n":',ret=""\n')+(U.debug?"debugger;":"")+I+(n?"\n":";\nreturn ret;"),ae.debugMode!==!1&&(I="try {\n"+I+"\n}catch(e){\nreturn j._err(e, view);\n}");try{I=new Function("data,view,j,u",I)}catch(L){J("Compiled template code:\n\n"+I+'\n: "'+L.message+'"')}return t&&(t.fn=I,t.useViews=!!F),I}function L(e,t){return e&&e!==t?t?u(u({},t),e):e:t&&u({},t)}function Q(e){return $e[e]||($e[e]="&#"+e.charCodeAt(0)+";")}function H(e){var t,n,r=[];if(typeof e===Se)for(t in e)n=e[t],n&&n.toJSON&&!n.toJSON()||ee(n)||r.push({key:t,prop:n});return r}function P(e,n,r){var i=this.jquery&&(this[0]||F('Unknown template: "'+this.selector+'"')),o=i.getAttribute(Ee);return N.call(o?t.data(i)[Fe]:ne(i),e,n,r)}function D(e){return void 0!=e?Te.test(e)&&(""+e).replace(Re,Q)||e:""}var Z=t===!1;t=t&&t.fn?t:e.jQuery;var z,G,W,X,Y,ee,te,ne,re,ie,oe,se,ae,de,ue,le,pe,ce,fe,ge,ve,he,me="v0.9.76",we=/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,xe=/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(!*?[#~]?[\w$.^]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=\s*[.^]|\s*$|[^([])|[)\]])([([]?))|(\s+)/g,be=/[ \t]*(\r\n|\n|\r)/g,_e=/\\(['"])/g,ye=/['"\\]/g,ke=/(?:\x08|^)(onerror:)?(?:(~?)(([\w$_\.]+):)?([^\x08]+))\x08(,)?([^\x08]+)/gi,je=/^if\s/,Ce=/<(\w+)[>\s]/,Ae=/[\x00`><"'&=]/g,Te=/[\x00`><\"'&=]/,Ve=/^on[A-Z]|^convert(Back)?$/,Re=Ae,Me=0,$e={"&":"&","<":"<",">":">","\x00":"�","'":"'",'"':""","`":"`","=":"="},Ne="html",Se="object",Ee="data-jsv-tmpl",Fe="jsvTmpl",Je="For #index in nested block use #getIndex().",Ie={},Oe=e.jsrender,Ue=Oe&&t&&!t.render,qe={template:{compile:j},tag:{compile:y},viewModel:{compile:T},helper:{},converter:{}};if(Y={jsviews:me,sub:{View:b,Err:d,tmplFn:I,parse:K,extend:u,extendCtx:L,syntaxErr:J,onStore:{},addSetting:M,settings:{allowCode:!1},advSet:s,_ths:i,_tg:function(){},_cnvt:h,_tag:x,_er:F,_err:E,_html:D,_sq:function(e){return"constructor"===e&&J(""),e}},settings:{delimiters:l,advanced:function(e){return e?(u(de,e),se.advSet(),ue):de}},map:$},(d.prototype=new Error).constructor=d,c.depends=function(){return[this.get("item"),"index"]},f.depends="index",b.prototype={get:p,getIndex:f,getRsc:w,getTmpl:v,hlp:g,_is:"view"},se=Y.sub,ue=Y.settings,!(Oe||t&&t.render)){for(z in qe)R(z,qe[z]);re=Y.converters,ie=Y.helpers,oe=Y.tags,se._tg.prototype={baseApply:k,cvtArgs:m},X=se.topView=new b,t?(t.fn.render=P,t.observable&&(u(se,t.views.sub),Y.map=t.views.map)):(t={},Z&&(e.jsrender=t),t.renderFile=t.__express=t.compile=function(){throw"Node.js: use npm jsrender, or jsrender-node.js"},t.isFunction=function(e){return"function"==typeof e},t.isArray=Array.isArray||function(e){return"[object Array]"==={}.toString.call(e)},se._jq=function(e){e!==t&&(u(e,t),t=e,t.fn.render=P,delete t.jsrender)},t.jsrender=me),ae=se.settings,ae.allowCode=!1,ee=t.isFunction,te=t.isArray,t.render=Ie,t.views=Y,t.templates=ne=Y.templates;for(ve in ae)M(ve);(ue.debugMode=function(e){return void 0===e?ae.debugMode:(ae.debugMode=e,ae.onError=e+""===e?new Function("","return '"+e+"';"):ee(e)?e:void 0,ue)})(!1),de=ae.advanced={useViews:!1,_jsv:!1},oe({"if":{render:function(e){var t=this,n=t.tagCtx,r=t.rendering.done||!e&&(arguments.length||!n.index)?"":(t.rendering.done=!0,t.selected=n.index,n.render(n.view,!0));return r},flow:!0},"for":{render:function(e){var t,n=!arguments.length,r=this,i=r.tagCtx,o="",s=0;return r.rendering.done||(t=n?i.view.data:e,void 0!==t&&(o+=i.render(t,n),s+=te(t)?t.length:1),(r.rendering.done=s)&&(r.selected=i.index)),o},flow:!0},props:{baseTag:"for",dataMap:$(H),flow:!0},include:{flow:!0},"*":{render:o,flow:!0},":*":{render:o,flow:!0},dbg:ie.dbg=re.dbg=a}),re({html:D,attr:D,url:function(e){return void 0!=e?encodeURI(""+e):null===e?e:""}})}return ae=se.settings,ue.delimiters("{{","}}","^"),Ue&&Oe.views.sub._jq(t),t||Oe},window); +//# sourceMappingURL=jsrender.min.js.map diff --git a/jsrender.min.js.map b/jsrender.min.js.map index 6588c20..e149700 100644 --- a/jsrender.min.js.map +++ b/jsrender.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["jsrender.js"],"names":["factory","global","$","jQuery","exports","module","fn","define","amd","getDerivedMethod","baseMethod","method","ret","tag","this","prevBase","base","apply","arguments","getMethod","$isFunction","_d","noop","tagHandlersFromProps","tagCtx","prop","props","rHasHandlers","test","retVal","val","dbgBreak","console","log","e","baseApply","JsViewsError","message","name","link","$extend","target","source","$viewsDelimiters","openChars","closeChars","$subSettings","delimiters","linkChar","charAt","delimOpenChar0","delimOpenChar1","delimCloseChar0","delimCloseChar1","rTag","$sub","RegExp","rTmplString","$viewsSettings","getView","inner","type","undefined","views","i","l","found","view","root","_","useKey","get","length","parent","getNestedIndex","index","getIndex","getHelper","helper","wrapped","ctx","linkCtx","res","$helpers","_wrp","getTemplate","tmpl","getRsc","$templates","convertVal","converter","onError","value","boundTag","bnds","args","data","_tg","inline","bnd","unlinked","tagName","cvt","flow","extendCtx","_er","cvtArgs","convert","onRender","convertArgs","error","slice","depends","getDeps","getResource","resourceType","itemName","store","$views","renderTag","parentView","tagCtxs","isUpdate","topView","tagDef","template","tags","attr","parentTag","itemRet","tagCtxCtx","content","callInit","mapDef","thisMap","initialTmpl","tagDataMap","parentTmpl","_is","tmpls","render","renderContent","getTmpl","_ctr","init","dataMap","arrVws","dataBoundOnly","map","parents","parentTags","rendering","src","unmap","tgt","noVws","HTML","$converters","html","View","context","key","contentTmpl","parentView_","self_","self","isArray","id","viewId","linked","indexStr","push","splice","compileChildResources","storeName","resources","resourceName","resource","settings","compile","onStore","jsvStores","compileTag","Tag","baseTag","compiledDef","$tags","prototype","constructor","_parentTmpl","compileTmpl","options","lookupTemplate","currentName","nodeType","elem","document","getElementById","find","innerHTML","getAttribute","tmplAttr","jsvTmpl","tmplName","setAttribute","compiledTmpl","tmplOrMarkup","markup","tmplObject","tmplFn","replace","rEscapeQuotes","$render","Map","getTgt","baseMap","htmlTag","wrapMap","$subSettingsAdvanced","_wm","links","rFirstElem","exec","toLowerCase","div","trim","registerStore","storeSettings","theStore","item","thisStore","OBJECT","storeNames","call","addSetting","st","noIteration","isTopRenderCall","prevData","prevIndex","result","isRenderCall","useViews","renderWithViews","$isArray","setItemVar","newCtx","itemVar","newView","childView","itemResult","swapContent","outerOnRender","syntaxError","helpers","it","onRenderError","fallback","Err","isLinkExpr","convertBack","hasElse","pushprecedingContent","shift","loc","substr","rNewLine","blockTagCheck","block","parseTag","all","bind","colon","codeTag","params","slash","bind2","closeBlock","pathBindings","ctxProps","paramsArgs","paramsProps","paramsCtxProps","useTrigger","allowCode","rUnescapeQuotes","rTestElseIf","current","substring","stack","pop","parseParams","rBuildHash","onerror","isCtx","keyToken","keyValue","arg","param","hasHandlers","newNode","parsedParam","astTop","buildCode","setPaths","pathsArr","paths","deps","concat","paramStructure","parts","parseTokens","lftPrn0","lftPrn","bound","path","operator","err","eq","path2","prn","comma","lftPrn2","apos","quot","rtPrn","rtPrnDot","prn2","space","full","parsePath","allPath","not","object","viewProperty","pathTokens","leafToken","subPath","bindings","binds","named","bindto","_jsvto","bndCtx","bd","theOb","_jsv","sb","pathStart","parenDepth","expr","exprFn","newOb","aposed","quoted","boundName","bndStack","prm","tmplLinks","indexOf","paramIndex","split","join","rPath","fnCall","rParams","ast","node","hasTag","hasEncoder","getsVal","hasCnvt","useCnvt","tmplBindings","boundOnErrStart","boundOnErrEnd","tagRender","nestedTmpls","nestedTmpl","tagAndElses","nextIsElse","oldCode","isElse","isGetVal","tagCtxFn","tagStart","trigger","tmplBindingKey","templates","converters","code","tmplOptions","debug","Function","_tag","debugMode","parentContext","getCharEntity","ch","charEntities","charCodeAt","getTargetProps","toJSON","$fnRender","tmplElem","jquery","selector","htmlEncode","text","rIsHtml","rHtmlEncode","setGlobals","jsvStoreName","setting","versionNumber","rAttrEncode","&","<",">","\u0000","'","\"","`","jsr","jsrender","jsrToJq","jsviews","sub","parse","extend","syntaxErr","advSet","_ths","_cnvt","_err","_html","advanced","Error","hlp","observable","renderFile","__express","isFunction","ob","Array","obj","_jq","jq","if","done","selected","for","finalElse","include","*",":*","dbg","url","encodeURI","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,OAE1B6F,EAAOvJ,KACPU,EAAS6I,EAAK7I,OACdwN,EAAS,GACTiN,EAAO,CAaR,OAXK5R,GAAKd,UAAU0S,OACnBrW,EAAQwW,EAAY5a,EAAO2C,KAAK6B,KAAOlE,EACzBgC,SAAV8B,IACHoJ,GAAUxN,EAAOoH,OAAOhD,EAAOwW,GAC/BH,GAAQ7M,EAASxJ,GAASA,EAAMpB,OAAS,IAEtC6F,EAAKd,UAAU0S,KAAOA,KACzB5R,EAAK6R,SAAW1a,EAAOmD,QAIlBqK,GAERzI,MAAM,GAEP7E,OACC8J,QAAS,MACTvC,QAASA,EAAQgQ,GACjB1S,MAAM,GAEP8V,SACC9V,MAAM,GAEP+V,KAEC1T,OAAQ/G,EACR0E,MAAM,GAEPgW,MAEC3T,OAAQ/G,EACR0E,MAAM,GAEPiW,IAAKrX,GAASqX,IAAM3S,GAAY2S,IAAMza,IAGvC8H,IACCC,KAAMyP,EACNxR,KAAMwR,EACNkD,IAAK,SAASjD,GAEb,MAAe1V,SAAR0V,EAAoBkD,UAAU,GAAKlD,GAAiB,OAATA,EAAgBA,EAAO,MAK3E9V,GAAeX,WAAW,KAAM,KAAM,KAMvC,MAHI0X,KACHF,GAAIxW,MAAM4W,IAAImB,IAAI5b,GAEZA,GAAKqa,IACToC","file":"jsrender.min.js","sourcesContent":["/*! JsRender v0.9.75 (Beta): http://jsviews.com/#jsrender */\n/*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */\n/*\n * Best-of-breed templating in browser or on Node.js.\n * Does not require jQuery, or HTML DOM\n * Integrates with JsViews (http://jsviews.com/#jsviews)\n *\n * Copyright 2016, Boris Moore\n * Released under the MIT License.\n */\n\n//jshint -W018, -W041\n\n(function(factory, global) {\n\t// global var is the this object, which is window when running in the usual browser environment\n\tvar $ = global.jQuery;\n\n\tif (typeof exports === \"object\") { // CommonJS e.g. Browserify\n\t\tmodule.exports = $\n\t\t\t? factory(global, $)\n\t\t\t: function($) { // If no global jQuery, take optional jQuery passed as parameter: require('jsrender')(jQuery)\n\t\t\t\tif ($ && !$.fn) {\n\t\t\t\t\tthrow \"Provide jQuery or null\";\n\t\t\t\t}\n\t\t\t\treturn factory(global, $);\n\t\t\t};\n\t} else if (typeof define === \"function\" && define.amd) { // AMD script loader, e.g. RequireJS\n\t\tdefine(function() {\n\t\t\treturn factory(global);\n\t\t});\n\t} else { // Browser using plain + diff --git a/test/unit-tests/requirejs-config.js b/test/unit-tests/requirejs-config.js index a5ba581..04ee19b 100644 --- a/test/unit-tests/requirejs-config.js +++ b/test/unit-tests/requirejs-config.js @@ -2,7 +2,7 @@ requirejs.config({ "baseUrl": "//www.jsviews.com/download", // Or point to correct local path on your system: "baseUrl": "/download", "paths": { - "jquery": "//code.jquery.com/jquery-1.12.0", + "jquery": "//code.jquery.com/jquery-1.12.3", "jsrender": "./jsrender", "jquery.observable": "./jquery.observable", "jquery.views": "./jquery.views", diff --git a/test/unit-tests/tests-jsrender-no-jquery.js b/test/unit-tests/tests-jsrender-no-jquery.js index 22f7d47..c91432b 100644 --- a/test/unit-tests/tests-jsrender-no-jquery.js +++ b/test/unit-tests/tests-jsrender-no-jquery.js @@ -57,7 +57,7 @@ test("{{if}} {{else}}", 4, function() { equal($.templates(" a'b\"c\\").render(), " a\'b\"c\\", "Correct escaping of quotes and backslash"); }); -test("syntax errors", 7, function() { +test("syntax errors", 15, function() { equal(compileTmpl("{^{*:foo}}"), "Syntax error\n{^{*:foo}}", "Syntax error for {^{* ...}}"); equal(compileTmpl("{{:foo/}}"), "Syntax error\n{{:foo/}}", "Syntax error for {{: ... /}}"); equal(compileTmpl("{{:foo:}}"), "Syntax error\n{{:foo:}}", "Syntax error for {{: ... :}}"); @@ -65,6 +65,17 @@ test("syntax errors", 7, function() { equal(compileTmpl("{{mytag foo :}}"), "Syntax error\n{{mytag foo :}}", "Syntax error for {{mytag ... :}}"); equal(compileTmpl("{^{mytag foo :}}"), "Syntax error\n{^{mytag foo :}}", "Syntax error for {^{mytag ... :}}"); equal(compileTmpl("{{if foo?bar:baz}}{{/if}}"), "compiled", "No syntax error for {{tag foo?bar:baz}}"); + equal(compileTmpl("{{for [1,2]/}}"), "Syntax error\n[1,2]", "Syntax error for {{for [1,2]}} - top-level array"); + equal(compileTmpl("{{:constructor()}}"), "Syntax error\nconstructor", "Syntax error for {{: ...constructor ...}}"); + equal(compileTmpl("{{for #tmpl.constructor()}}"), "Syntax error\n#tmpl.constructor", "Syntax error for {{for ...constructor ...}}"); + +$.views.settings.debugMode(true); + equal($.templates('{{:#data["constructor"]["constructor"]("alert(0);")()}}').render(), "{Error: Syntax error\n}", 'Syntax error 1 for ["constructor]"'); + equal($.templates('{{:valueOf["constructor"]("alert(1);")()}}').render(1), "{Error: Syntax error\n}", 'Syntax error 2 for ["constructor]"'); + equal($.templates('{{:valueOf["const"+"ructor"]("alert(2);")()}}').render(1), "{Error: Syntax error\n}", 'Syntax error 3 for ["constructor]"'); + equal($.templates('{{if true ~c=toString["con" + foo + "or"]}}{{:convert=~c("alert(3);")}}{{/if}}').render({foo: "struct"}), "{Error: Syntax error\n}", 'Syntax error 1 for indirect ["constructor]"'); + equal($.templates('{{if true ~tmp="constructo"}}{{if true ~tmp2="r"}}{{:toString[~tmp + ~tmp2]}}{{/if}}{{/if}}').render(1), "{Error: Syntax error\n}", 'Syntax error 2 for indirect ["constructor]"'); +$.views.settings.debugMode(false); }); QUnit.module("{{if}}"); @@ -138,8 +149,6 @@ test("types", function() { equal($.templates("{{:-33.33 - 2.2}}").render(), "-35.53", "-33.33 - 2.2"); equal($.templates("{{:notdefined}}").render({}), "", "notdefined"); equal($.templates("{{:}}").render("aString"), "aString", "{{:}} returns current data item"); - -//$.views.settings.trigger(true); equal($.templates("{{:x=22}}").render("aString"), "aString", "{{:x=...}} returns current data item"); equal($.templates("{{html:x=22}}").render("aString"), "aString", "{{html:x=...}} returns current data item"); equal($.templates("{{>x=22}}").render("aString"), "aString", "{{>x=...}} returns current data item"); @@ -791,7 +800,7 @@ test("", function() { + "{{/for}}"); // ................................ Act .................................. - var originalUseViews = tmpl.useViews; + originalUseViews = tmpl.useViews; tmpl.useViews = true; // ................................ Assert .................................. @@ -1645,8 +1654,8 @@ test('{{include}} and wrapping content', function() { + " This (new template) wraps: headerJofooter |" + " This (render method) replaces: replacementText |" + " This (original template) adds: addBill |" - + " This (new template) wraps: headerBillfooter | " - , 'Custom tag with wrapped content: {{myTag ... tmpl="wrapper"}}wrapped{{/myTmpl}}'); + + " This (new template) wraps: headerBillfooter | ", + 'Custom tag with wrapped content: {{myTag ... tmpl="wrapper"}}wrapped{{/myTmpl}}'); result = $.templates({ markup: @@ -1870,7 +1879,7 @@ test("settings", function() { result = ""; // ................................ Act .................................. - $.views.settings.debugMode(false) + $.views.settings.debugMode(false); try { result = $.templates('{{:missing.willThrow}}').render(app); @@ -2081,7 +2090,6 @@ $.templates({ // ............................... Assert ................................. equal($.templates.nesting.render({}, {b: "optionHelper"}), " templateHelper templateCvt innerTemplateHelper innerTemplateCvt innerInnerCascade innerCascade", 'Inner template, helper, and converter override outer template, helper, and converter'); - }); })(); diff --git a/test/unit-tests/tests-jsrender-with-jquery.js b/test/unit-tests/tests-jsrender-with-jquery.js index 0a0b0a3..b7a242b 100644 --- a/test/unit-tests/tests-jsrender-with-jquery.js +++ b/test/unit-tests/tests-jsrender-with-jquery.js @@ -29,7 +29,7 @@ module("api"); test("templates", function() { var tmplElem = document.getElementById("./test/templates/file/path.html"); - // ................................ Arrange .................................. + // =============================== Arrange =============================== $.removeData(tmplElem, "jsvTmpl"); // In case data has been set in a previous test // ................................ Act .................................. @@ -65,25 +65,25 @@ test("templates", function() { tmplElem.removeAttribute("data-jsv-tmpl"); // ................................ Act .................................. - var tmpl0 = $.templates({markup: "#myTmpl"}); // Compile template declared in script block, but do not cache + tmpl0 = $.templates({markup: "#myTmpl"}); // Compile template declared in script block, but do not cache // ............................... Assert ................................. equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), isIE8 ? "\nA_Jo0_B" : "A_Jo0_B", "Compile template declared in script block, without caching"); // ................................ Act .................................. - var tmpl1 = $.templates("#myTmpl"); // Compile and cache, using $.data(elem, "jsvTmpl", tmpl); + tmpl1 = $.templates("#myTmpl"); // Compile and cache, using $.data(elem, "jsvTmpl", tmpl); // ............................... Assert ................................. equal(tmpl1 !== tmpl0 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl1.render({name: "Jo1"}), isIE8 ? "\nA_Jo1_B" : "A_Jo1_B", "Compile template declared in script block, and cache on file path"); // ................................ Act .................................. - var tmpl2 = $.templates("#myTmpl"); // Use cached template, accessed by $.data(elem, "jsvTmpl") + tmpl2 = $.templates("#myTmpl"); // Use cached template, accessed by $.data(elem, "jsvTmpl") // ............................... Assert ................................. equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), isIE8 ? "\nA_Jo2_B" : "A_Jo2_B", "Re-use cached template declared in script block"); // ................................ Act .................................. - var tmpl3 = $.templates({markup: "#myTmpl"}); // Re-compile template but do not cache. Leaved cached template. + tmpl3 = $.templates({markup: "#myTmpl"}); // Re-compile template but do not cache. Leave cached template. // ............................... Assert ................................. equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), isIE8 ? "\nA_Jo3_B" : "A_Jo3_B", "Recompile template declared in script block, without caching"); @@ -108,8 +108,8 @@ test("templates", function() { equal($.templates(tmplString).render(person), "A_Jo_B", 'Compile without registering as named template: $.templates(tmplString).render(person);'); - var tmpl2 = $.templates("#my_tmpl"); - var tmpl3 = $.templates("#my_tmpl"); + tmpl2 = $.templates("#my_tmpl"); + tmpl3 = $.templates("#my_tmpl"); equal(tmpl2 === tmpl3 && $.trim(tmpl2.render(person)), "A_Jo_B", 'var tmpl = $.templates("#my_tmpl"); returns compiled template for script element'); $.templates({ @@ -120,7 +120,7 @@ test("templates", function() { equal($.render.my_tmpl3 === $.templates.my_tmpl3 && $.templates.my_tmpl3 !== tmpl2 && $.trim($.render.my_tmpl3(person)), "A_Jo_B", 'Named template for template object with selector: { markup: "#my_tmpl" }'); - var tmpl3 = $.templates("", { + tmpl3 = $.templates("", { markup: "#my_tmpl" }); equal($.trim(tmpl3.render(person)), "A_Jo_B", 'Compile from template object with selector, without registering: { markup: "#my_tmpl" }'); @@ -249,4 +249,203 @@ test("template encapsulation", 1, function() { equal($.render.myTmpl6({ people: people }), "BillJo", '$.templates("my_tmpl", tmplObjWithNestedItems);'); }); +test("$.views.viewModels", function() { + // =============================== Arrange =============================== + var Constr = $.views.viewModels({getters: ["a", "b"]}); + // ................................ Act .................................. + var vm = Constr("a1 ", "b1 "); + var result = vm.a() + vm.b(); + vm.a("a2 "); + vm.b("b2 "); + result += vm.a() + vm.b(); + // ............................... Assert ................................. + equal(result, "a1 b1 a2 b2 ", "viewModels, two getters, no methods"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({getters: ["a", "b", "c"], extend: {add: function(val) { + this.c(val + this.a() + this.b() + this.c()); + }}}); + // ................................ Act .................................. + vm = Constr("a1 ", "b1 ", "c1 "); + vm.add("before "); + result = vm.c(); + // ............................... Assert ................................. + equal(result, "before a1 b1 c1 ", "viewModels, two getters, one method"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({extend: {add: function(val) { + this.foo = val; + }}}); + // ................................ Act .................................. + vm = Constr(); + vm.add("before"); + result = vm.foo; + // ............................... Assert ................................. + equal(result, "before", "viewModels, no getters, one method"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({getters: []}); + // ................................ Act .................................. + vm = Constr(); + result = JSON.stringify(vm); + // ............................... Assert ................................. + equal(result, "{}", "viewModels, no getters, no methods"); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b"] + } + }); + // ................................ Act .................................. + vm = $.views.viewModels.T1.map({a: "a1 ", b: "b1 "}); + + result = vm.a() + vm.b(); + vm.a("a2 "); + vm.b("b2 "); + result += vm.a() + vm.b(); + + // ............................... Assert ................................. + equal(result, "a1 b1 a2 b2 ", "viewModels, two getters, no methods"); + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 "}); + + result = vm.a() + vm.b(); + + // ............................... Assert ................................. + equal(result, "a3 b3 ", "viewModels merge, two getters, no methods"); + + // ................................ Act .................................. + result = vm.unmap(); + result = JSON.stringify(result); + + // ............................... Assert ................................. + equal(result, '{"a":"a3 ","b":"b3 "}', "viewModels unmap, two getters, no methods"); + + // =============================== Arrange =============================== + var viewModels = $.views.viewModels({ + T1: { + getters: ["a", {getter: "b"}, "c", "d", {getter: "e", type: undefined}, {getter: "f", type: null}, {getter: "g", type: "foo"}, {getter: "h", type: ""}] + } + }, {}); + // ................................ Act .................................. + vm = viewModels.T1.map({a: "a1 ", b: "b1 ", c: "c1 ", d: "d1 ", e: "e1 ", f: "f1 ", g: "g1 ", h: "h1 "}); + result = vm.a() + vm.b() + vm.c() + vm.d() + vm.e() + vm.f() + vm.g() + vm.h(); + vm.a("a2 "); + vm.b("b2 "); + result += vm.a() + vm.b(); + // ............................... Assert ................................. + equal(result, "a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 ", + "viewModels, multiple unmapped getters, no methods"); + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 ", c: "c3 ", d: "d3 ", e: "e3 ", f: "f3 ", g: "g3 ", h: "h3 "}); + + result = vm.a() + vm.b() + vm.c() + vm.d() + vm.e() + vm.f() + vm.g() + vm.h(); + + // ............................... Assert ................................. + equal(result, "a3 b3 c3 d3 e3 f3 g3 h3 ", + "viewModels merge, multiple unmapped getters, no methods"); + + // ................................ Act .................................. + result = vm.unmap(); + result = JSON.stringify(result); + + // ............................... Assert ................................. + equal(result, '{"a":"a3 ","b":"b3 ","c":"c3 ","d":"d3 ","e":"e3 ","f":"f3 ","g":"g3 ","h":"h3 "}', + "viewModels unmap, multiple unmapped getters, no methods"); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b", "c"], + extend : { + add: function(val) { + this.c(val + this.a() + this.b() + this.c()); + } + } + } + }); + + // ................................ Act .................................. + vm = $.views.viewModels.T1.map({a: "a1 ", b: "b1 ", c: "c1 "}); + + vm.add("before "); + result = vm.c(); + + // ............................... Assert ................................. + equal(result, "before a1 b1 c1 ", "viewModels, getters and one method"); + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 ", c: "c3 "}); + vm.add("updated "); + result = vm.c(); + + // ............................... Assert ................................. + equal(result, "updated a3 b3 c3 ", "viewModels merge, getters and one method"); + + // ................................ Act .................................. + result = vm.unmap(); + result = JSON.stringify(result); + + // ............................... Assert ................................. + equal(result, '{"a":"a3 ","b":"b3 ","c":"updated a3 b3 c3 "}', "viewModels unmap, getters and one method"); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b"] + }, + T2: { + getters: [{getter: "t1", type: "T1"}, {getter: "t1Arr", type: "T1"}, {getter: "t1OrNull", type: "T1", defaultVal: null}] + } + }); + viewModels = $.views.viewModels; + // ................................ Act .................................. + var t1 = viewModels.T1.map({a: "a1 ", b: "b1 "}); // Create a T1 + var t2 = viewModels.T2.map({t1: {a: "a3 ", b: "b3 "}, t1Arr: [t1.unmap(), {a: "a2 ", b: "b2 "}]}); // Create a T2 (using unmap to scrape values the T1: vm) + + result = JSON.stringify(t2.unmap()); + + // ............................... Assert ................................. + equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + t2.t1Arr()[0].merge({a: "a1x ", b: "b1x "}); // merge not the root, but a VM instance within hierarchy: vm2.t1Arr()[0] - leaving rest unchanged + result = JSON.stringify(t2.unmap()); + + // ............................... Assert ................................. + equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1x ","b":"b1x "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}', + "viewModels, merge deep node"); + + // ................................ Act .................................. + var t1Arr = viewModels.T1.map([{a: "a1 ", b: "b1 "}, {a: "a2 ", b: "b2 "}]); // Create a T1 array + var t2FromArr = viewModels.T2.map({t1: {a: "a3 ", b: "b3 "}, t1Arr: t1Arr.unmap()}); // Create a T2 (using unmap to scrape values the T1: vm) + result = JSON.stringify(t2FromArr.unmap()); + + // ............................... Assert ................................. + equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + t1Arr = viewModels.T1.map([{a: "a1 ", b: "b1 "}, {a: "a2 ", b: "b2 "}]); // Create a T1 array + t1Arr.push(viewModels.T1("a3 ", "b3 ")); + t2FromArr = viewModels.T2.map({t1: {a: "a4 ", b: "b4 "}, t1Arr: t1Arr.unmap()}); // Create a T2 (using unmap to scrape values the T1: vm) + result = JSON.stringify(t2FromArr.unmap()); + + // ............................... Assert ................................. + equal(result, '{"t1":{"a":"a4 ","b":"b4 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "},{"a":"a3 ","b":"b3 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + var t2new= viewModels.T2(viewModels.T1("a3 ", "b3 "), [viewModels.T1("a1 ", "b1 "), viewModels.T1("a2 ", "b2 ")], viewModels.T1("a4 ", "b4 ") ); + result = JSON.stringify(t2new.unmap()); + + // ............................... Assert ................................. + equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":{"a":"a4 ","b":"b4 "}}', + "viewModels, hierarchy"); +}); + })(this, this.jQuery); diff --git a/test/unit-tests/tests-node.js b/test/unit-tests/tests-node.js index 354deff..c849b35 100644 --- a/test/unit-tests/tests-node.js +++ b/test/unit-tests/tests-node.js @@ -1,6 +1,7 @@ /*global test, equal, ok, QUnit*/ (function(undefined) { "use strict"; + var jsrender = require('./../../jsrender-node.js'); var tmplify = require('./../../tmplify/index.js'); @@ -31,7 +32,7 @@ test("jsrender.templates", function() { }); test("jsrender.compile", function() { - var tmpl = jsrender.compile('./test/templates/name-template.html'); + var tmpl = jsrender.compile('./test/templates/name-template.html'); var html = tmpl({ name: "Jo" }); equal(html, "Name: Jo (name-template.html)", 'jsrender.compile("./file.path.html") compiles template'); @@ -43,7 +44,7 @@ test("jsrender.compile", function() { test("jsrender.tags.clientTemplate", function() { jsrender.views.settings.delimiters("<%", "%>"); var tmpl = jsrender.compile( - '\n' + '\n' + '\n' + '<%clientTemplate "./test/templates/outer.html"/%>\n' + '<%clientTemplate "./test/templates/inner.html"/%>\n' @@ -52,7 +53,7 @@ test("jsrender.tags.clientTemplate", function() { + ''); var html = tmpl({ name: "Jo" }); equal(html, - '\n' + '\n' + '\n' + '\n' + '\n' diff --git a/tmplify/index.js b/tmplify/index.js index 59a76bf..ed616f6 100644 --- a/tmplify/index.js +++ b/tmplify/index.js @@ -8,10 +8,12 @@ (function() { "use strict"; var jsrender = require('./../jsrender-node.js'), + fs = require('fs'), path = require('path'), pathSep = path.sep, through = require('through2'), - rootDirNameLen = path.resolve("./").length + 1; + rootDirPath = path.resolve("./"), + rootDirPathLen = rootDirPath.length + 1; function isTemplate(fileExt, extensions) { extensions = typeof extensions === "string" @@ -26,7 +28,6 @@ module.exports = function(file, options) { if (!isTemplate(path.extname(file).slice(1), options && (options.extensions || options.e))) { return through(); } - return through(function(buf, enc, next) { var createTmplCode, ref, pathFromFileDir, markup = buf.toString().replace(/^\uFEFF/, ''), // Remove BOM if necessary @@ -34,10 +35,16 @@ module.exports = function(file, options) { bundledFile = 'var tmplRefs = [],\n' + " mkup = '" + markup.replace(/['"\\]/g, "\\$&").replace(/[ \t]*(\r\n|\n|\r)/g, '\\n') + "',\n" // Normalize newlines, and escape quotes and \ character + ' $ = global.jsrender || global.jQuery;\n\n', - templateName = './' + file.slice(rootDirNameLen).split(pathSep).join('/'); + templateName = './' + file.slice(rootDirPathLen).split(pathSep).join('/'); for (ref in tmpl.refs) { // Recursively bundle any nested template references, e.g. {{include tmpl="./some/template.html/}}" + fs.stat(ref, function(err, stat) { + // Async check that file exists + if(err && err.code == 'ENOENT') { + throw new Error("Template '" + ref + "' not found at '" + err.path + "'. Use path relative to '" + rootDirPath + "'."); + } + }); pathFromFileDir = './' + path.relative(nodeFileDirName, ref).split(pathSep).join('/'); bundledFile += 'tmplRefs.push(require("' + pathFromFileDir + '"));\n'; }