@kosatyi/ejs 0.0.76 → 0.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -312,6 +312,7 @@
312
312
  BUFFER = _compiler$vars.BUFFER,
313
313
  COMPONENT = _compiler$vars.COMPONENT;
314
314
  var GLOBALS = compiler.globalHelpers;
315
+ content = String(content);
315
316
  if (compiler.rmWhitespace) {
316
317
  content = content.replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
317
318
  }
@@ -326,7 +327,7 @@
326
327
  });
327
328
  });
328
329
  source += "');";
329
- source = "try{".concat(source, "}catch(e){console.info(e)}");
330
+ source = "try{".concat(source, "}catch(e){return ").concat(BUFFER, ".error(e)}");
330
331
  if (compiler.withObject) {
331
332
  source = "with(".concat(SCOPE, "){").concat(source, "}");
332
333
  }
@@ -438,11 +439,36 @@
438
439
  return result.join('');
439
440
  };
440
441
 
442
+ function TemplateError(message) {
443
+ this.code = 1;
444
+ this.name = 'TemplateError';
445
+ this.message = message;
446
+ Error.call(this);
447
+ }
448
+ Object.setPrototypeOf(TemplateNotFound.prototype, Error.prototype);
449
+ function TemplateNotFound(message) {
450
+ TemplateError.call(this);
451
+ this.code = 404;
452
+ this.name = 'TemplateNotFound';
453
+ this.message = message;
454
+ }
455
+ Object.setPrototypeOf(TemplateNotFound.prototype, TemplateError.prototype);
456
+ function TemplateSyntaxError(message) {
457
+ TemplateError.call(this);
458
+ this.code = 500;
459
+ this.name = 'TemplateSyntaxError';
460
+ this.message = message;
461
+ }
462
+ Object.setPrototypeOf(TemplateSyntaxError.prototype, TemplateError.prototype);
463
+
441
464
  function resolve(list) {
442
465
  return Promise.all(list || []).then(function (list) {
443
466
  return list.join('');
444
467
  });
445
468
  }
469
+ function reject(error) {
470
+ return Promise.reject(new TemplateSyntaxError(error.message));
471
+ }
446
472
  function createBuffer() {
447
473
  var store = [],
448
474
  array = [];
@@ -462,7 +488,7 @@
462
488
  return resolve(result);
463
489
  };
464
490
  buffer.error = function (e) {
465
- throw e;
491
+ return reject(e);
466
492
  };
467
493
  buffer.end = function () {
468
494
  return resolve(array);
@@ -487,6 +513,11 @@
487
513
  this.helpers = function (methods) {
488
514
  extend(Scope.prototype, methods || {});
489
515
  };
516
+ /**
517
+ * @name ContextScope
518
+ * @param data
519
+ * @constructor
520
+ */
490
521
  function Scope(data) {
491
522
  this[BLOCKS] = {};
492
523
  this[MACRO] = {};
@@ -632,8 +663,8 @@
632
663
  var prop = path.pop();
633
664
  return hasProp(result, prop) ? result[prop] : defaults;
634
665
  },
635
- writable: false,
636
- configurable: false,
666
+ writable: true,
667
+ configurable: true,
637
668
  enumerable: false
638
669
  }), _defineProperty(_Object$definePropert, "set", {
639
670
  value: function value(name, _value2) {
@@ -773,13 +804,15 @@
773
804
  var compiler = new Compiler(config);
774
805
  var cache = new Cache();
775
806
  var template = new Template(config, cache, compiler);
776
- var output = function output(path, context) {
777
- var params = [context, context.getComponent(), context.getBuffer(), safeValue];
778
- config.globalHelpers.forEach(function (name) {
779
- if (isFunction(context[name])) params.push(context[name].bind(context));
780
- });
807
+ var output = function output(path, scope) {
808
+ var globalHelpers = config.globalHelpers;
809
+ var params = [scope, scope.getComponent(), scope.getBuffer(), safeValue].concat(globalHelpers.filter(function (name) {
810
+ return isFunction(scope[name]);
811
+ }).map(function (name) {
812
+ return scope[name].bind(scope);
813
+ }));
781
814
  return template.get(path).then(function (callback) {
782
- return callback.apply(context, params);
815
+ return callback.apply(scope, params);
783
816
  });
784
817
  };
785
818
  var require = function require(name) {
@@ -840,7 +873,7 @@
840
873
  return fetch(joinPath(path, template)).then(function (response) {
841
874
  return response.text();
842
875
  }, function (reason) {
843
- return String(reason);
876
+ return new TemplateError(reason);
844
877
  });
845
878
  };
846
879
 
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var n=function(){var e=[].slice.call(arguments),n=e.shift();return e.filter(n).pop()},t=function(e){return Array.isArray(e)},r=function(e){return"function"==typeof e},i=function(e){return"string"==typeof e},o=function(e){return"boolean"==typeof e},u=function(e){return void 0===e},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a=function(){return c},l={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},f=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},h=f(s),p=f(l),b=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(h,(function(e){return s[e]}))},v=function(e){return(""+e).replace(p,(function(e){return"\\"+l[e]}))},g=function(e,n){var t=e;return null==t?"":!0===n?b(t):t},m=function(e,n){return Boolean(e instanceof n)},d=function(e,n,t){for(var i=e,o=String(n).split("."),u=o.pop(),c=0;c<o.length;c++){var a=o[c];if(r(i.toJSON)&&(i=i.toJSON()),t&&!1===i.hasOwnProperty(a)){i={};break}i=i[a]=i[a]||{}}return r(i.toJSON)&&(i=i.toJSON()),[i,u]},w=function(e,n){var t=e.split(".").pop();return t!==n&&(e=[e,n].join(".")),e},y=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return t.filter((function(e){return e})).reduce((function(e,n){return Object.assign(e,n)}),e)},j=function(){},E=function(e,n){var t;for(t in e)k(e,t)&&n(e[t],t,e)},x=function(e,n){return function(e,n,t){var r=e instanceof Array,i=r?[]:{};return E(e,(function(e,t,o){var c=n(e,t,o);!1===u(c)&&(r?i.push(c):i[t]=c)})),i}(e,(function(e,t){if(-1===n.indexOf(t))return e}))},O=function(e,n,t){return Promise.resolve(e).then(n.bind(t))},k=function(e,n){return e&&e.hasOwnProperty(n)},F={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(e,n){return Promise.resolve(["resolver is not defined",e,n].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},S=function(e,u){y(e,{path:n(i,F.path,e.path,u.path),export:n(i,F.export,e.export,u.export),resolver:n(r,F.resolver,e.resolver,u.resolver),extension:n(i,F.extension,e.extension,u.extension),withObject:n(o,F.withObject,e.withObject,u.withObject),rmWhitespace:n(o,F.rmWhitespace,e.rmWhitespace,u.rmWhitespace),cache:n(o,F.cache,e.cache,u.cache),token:y({},F.token,e.token,u.token),vars:y({},F.vars,e.vars,u.vars),globalHelpers:n(t,F.globalHelpers,e.globalHelpers,u.globalHelpers)})},B="undefined"!=typeof globalThis?globalThis:window||self;function P(e){if(!1===m(this,P))return new P;var n={enabled:!0,list:{}};this.configure=function(e){n.enabled=e.cache,!1===a()&&this.load(B[e.export])},this.clear=function(){n.list={}},this.load=function(e){return n.enabled&&y(n.list,e||{}),this},this.get=function(e){if(n.enabled)return n.list[e]},this.set=function(e,t){return n.enabled&&(n.list[e]=t),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete n.list[e]},this.exist=function(e){return k(n.list,e)}}var R=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function T(e){if(!1===m(this,T))return new T(e);var n={};this.configure=function(e){n.withObject=e.withObject,n.rmWhitespace=e.rmWhitespace,n.token=e.token,n.vars=e.vars,n.globalHelpers=e.globalHelpers,n.matches=[],n.formats=[],n.slurp={match:"[ \\t]*",start:[n.token.start,"_"],end:["_",n.token.end]},R.forEach((function(e){n.matches.push(n.token.start.concat(e.symbol).concat(n.token.regex).concat(n.token.end)),n.formats.push(e.format.bind(n.vars))})),n.regex=new RegExp(n.matches.join("|").concat("|$"),"g"),n.slurpStart=new RegExp([n.slurp.match,n.slurp.start.join("")].join(""),"gm"),n.slurpEnd=new RegExp([n.slurp.end.join(""),n.slurp.match].join(""),"gm")},this.compile=function(e,t){var r=n.vars,i=r.SCOPE,o=r.SAFE,u=r.BUFFER,c=r.COMPONENT,a=n.globalHelpers;n.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(n.slurpStart,n.token.start).replace(n.slurpEnd,n.token.end);var l,s,f,h="".concat(u,"('");l=n.regex,s=function(t,r,i){h+=v(e.slice(r,i)),t.forEach((function(e,t){e&&(h+=n.formats[t](e))}))},f=0,e.replace(l,(function(){var e=[].slice.call(arguments,0,-1),n=e.pop(),t=e.shift();return s(e,f,n),f=n+t.length,t})),h="try{".concat(h+="');","}catch(e){console.info(e)}"),n.withObject&&(h="with(".concat(i,"){").concat(h,"}")),h="".concat(u,".start();").concat(h,"return ").concat(u,".end();"),h+="\n//# sourceURL=".concat(t);var p=null,b=[i,c,u,o].concat(a);try{(p=Function.apply(null,b.concat(h))).source="(function(".concat(b.join(","),"){\n").concat(h,"\n})")}catch(e){throw e.filename=t,e.source=h,e}return p},this.configure(e)}function $(e,n,t){if(!1===m(this,$))return new $(e,n,t);if(!1===m(n,P))throw new TypeError("cache is not instance of Cache");if(!1===m(t,T))throw new TypeError("compiler is not instance of Compiler");var i={},o=function(e){return i.resolver(i.path,e)};this.configure=function(e){i.path=e.path,i.cache=e.cache,r(e.resolver)&&(i.resolver=e.resolver)},this.get=function(e){return n.exist(e)?n.resolve(e):o(e).then((function(i){return function(e,t){return n.set(e,t),t}(e,function(e,n){return r(e)?e:t.compile(e,n)}(i,e))}))},this.configure(e)}function A(e,n,t){return(n=function(e){var n=function(e,n){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:String(n)}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var C=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],N=" ",U='"',M="/",H="<",L=">",W=function(e,n,t){var r=[],i=-1===C.indexOf(e),o=function(e,n,t){var r=[];return E(e,(function(e,t,i){var o=n(e,t,i);!1===u(o)&&r.push(o)})),r}(n,(function(e,n){if(null!=e)return[b(n),[U,b(e),U].join("")].join("=")})).join(N);return r.push([H,e,N,o,L].join("")),t&&r.push(t instanceof Array?t.join(""):t),i&&r.push([H,M,e,L].join("")),r.join("")};function J(e){return Promise.all(e||[]).then((function(e){return e.join("")}))}function q(){var e=[],n=[];function t(e){n.push(e)}return t.start=function(){n=[]},t.backup=function(){e.push(n.concat()),n=[]},t.restore=function(){var t=n.concat();return n=e.pop(),J(t)},t.error=function(e){throw e},t.end=function(){return J(n)},t}function D(e){if(!1===m(this,D))return new D(e);this.configure=function(e,n){var t,o=e.vars,u=o.BLOCKS,c=o.MACRO,a=o.EXTEND,l=o.LAYOUT,s=o.BUFFER,f=o.COMPONENT;function h(e){this[u]={},this[c]={},y(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){y(h.prototype,e||{})},h.prototype=y({},n||{}),Object.defineProperties(h.prototype,(A(t={},s,{value:q(),writable:!0,configurable:!1,enumerable:!1}),A(t,u,{value:{},writable:!0,configurable:!1,enumerable:!1}),A(t,c,{value:{},writable:!0,configurable:!1,enumerable:!1}),A(t,l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),A(t,a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),A(t,"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),A(t,"getBuffer",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),A(t,"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),A(t,"getBlocks",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),A(t,"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),A(t,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),A(t,"setLayout",{value:function(e){this[l]=e},writable:!1,configurable:!1,enumerable:!1}),A(t,"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),A(t,"clone",{value:function(e){var n=[l,a,s];return!0===e&&n.push(u),x(this,n)},writable:!1,configurable:!1,enumerable:!1}),A(t,"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),A(t,"echo",{value:function(e){var n=this.getBuffer();[].slice.call(arguments).forEach(n)},writable:!1,configurable:!1,enumerable:!1}),A(t,"fn",{value:function(e){var n=this.getBuffer(),t=this;return function(){return n.backup(),r(e)&&e.apply(t,arguments),n.restore()}},writable:!1,configurable:!1,enumerable:!1}),A(t,"get",{value:function(e,n){var t=d(this,e,!0),r=t.shift(),i=t.pop();return k(r,i)?r[i]:n},writable:!1,configurable:!1,enumerable:!1}),A(t,"set",{value:function(e,n){var t=d(this,e,!1),r=t.shift(),i=t.pop();return this.getExtend()&&k(r,i)?r[i]:r[i]=n},writable:!1,configurable:!1,enumerable:!1}),A(t,"macro",{value:function(e,n){var t=this.getMacro(),r=this.fn(n),i=this;t[e]=function(){return i.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),A(t,"call",{value:function(e){var n=this.getMacro()[e],t=[].slice.call(arguments,1);if(r(n))return n.apply(n,t)},writable:!1,configurable:!1,enumerable:!1}),A(t,"block",{value:function(e,n){var t=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(n)),!this.getExtend()){var i=Object.assign([],r[e]),o=function(){return i.shift()};this.echo(o()(function e(){var n=o();return n?function(){t.echo(n(e()))}:j}()))}},writable:!1,configurable:!1,enumerable:!1}),A(t,"include",{value:function(e,n,t){var r=!1===t?{}:this.clone(!0),i=y(r,n||{}),o=this.render(e,i);this.echo(o)},writable:!1,configurable:!1,enumerable:!1}),A(t,"use",{value:function(e,n){var t=this.require(e);this.echo(O(t,(function(e){var t=this.getMacro();E(e,(function(e,r){t[[n,r].join(".")]=e}))}),this))},writable:!1,configurable:!1,enumerable:!1}),A(t,"async",{value:function(e,n){this.echo(O(e,(function(e){return this.fn(n)(e)}),this))},writable:!1,configurable:!1,enumerable:!1}),A(t,"each",{value:function(e,n){i(e)&&(e=this.get(e,[])),E(e,n)},writable:!1,configurable:!1,enumerable:!1}),A(t,"element",{value:function(e,n,t){return W(e,n,t)},writable:!1,configurable:!1,enumerable:!1}),A(t,"el",{value:function(e,n,t){r(t)&&(t=this.fn(t)()),this.echo(O(t,(function(t){return this.element(e,n,t)}),this))},writable:!1,configurable:!1,enumerable:!1}),t))},this.configure(e)}var K=new function e(n){if(!1===m(this,e))return new e(n);var t={},i={};S(i,n||{});var o=new D(i),u=new T(i),c=new P,a=new $(i,c,u),l=function(e,n){var t=[n,n.getComponent(),n.getBuffer(),g];return i.globalHelpers.forEach((function(e){r(n[e])&&t.push(n[e].bind(n))})),a.get(e).then((function(e){return e.apply(n,t)}))},s=function e(n,t){var r=w(n,i.extension),u=o.create(t);return l(r,u).then((function(n){if(u.getExtend()){u.setExtend(!1);var t=u.getLayout(),r=u.clone();return e(t,r)}return n}))};return this.configure=function(e){return S(i,e=e||{}),o.configure(i,t),u.configure(i),c.configure(i),a.configure(i),i},this.render=function(e,n){return s(e,n)},this.helpers=function(e){o.helpers(y(t,e))},this.preload=function(e){return c.load(e||{})},this.create=function(n){return new e(n)},this.compile=function(e,n){return u.compile(e,n)},this.context=function(e){return o.create(e)},this.helpers({require:function(e){var n=w(e,i.extension),t=o.create({});return l(n,t).then((function(){return t.getMacro()}))},render:s}),this}({resolver:function(e,n){return fetch(function(e,n){return(n=[e,n].join("/")).replace(/\/\//g,"/")}(e,n)).then((function(e){return e.text()}),(function(e){return String(e)}))}}),X=K.render,Y=K.context,_=K.compile,z=K.helpers,G=K.preload,I=K.configure,Q=K.create;e.compile=_,e.configure=I,e.context=Y,e.create=Q,e.helpers=z,e.preload=G,e.render=X}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var t=function(){var e=[].slice.call(arguments),t=e.shift();return e.filter(t).pop()},n=function(e){return Array.isArray(e)},r=function(e){return"function"==typeof e},i=function(e){return"string"==typeof e},o=function(e){return"boolean"==typeof e},u=function(e){return void 0===e},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},s=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},f=s(l),h=s(a),p=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(f,(function(e){return l[e]}))},b=function(e,t){var n=e;return null==n?"":!0===t?p(n):n},g=function(e,t){return Boolean(e instanceof t)},v=function(e,t,n){for(var i=e,o=String(t).split("."),u=o.pop(),c=0;c<o.length;c++){var a=o[c];if(r(i.toJSON)&&(i=i.toJSON()),n&&!1===i.hasOwnProperty(a)){i={};break}i=i[a]=i[a]||{}}return r(i.toJSON)&&(i=i.toJSON()),[i,u]},m=function(e,t){var n=e.split(".").pop();return n!==t&&(e=[e,t].join(".")),e},d=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.filter((function(e){return e})).reduce((function(e,t){return Object.assign(e,t)}),e)},w=function(){},y=function(e,t){var n;for(n in e)x(e,n)&&t(e[n],n,e)},j=function(e,t){return function(e,t){var n=e instanceof Array,r=n?[]:{};return y(e,(function(e,i,o){var c=t(e,i,o);!1===u(c)&&(n?r.push(c):r[i]=c)})),r}(e,(function(e,n){if(-1===t.indexOf(n))return e}))},E=function(e,t,n){return Promise.resolve(e).then(t.bind(n))},x=function(e,t){return e&&e.hasOwnProperty(t)},O={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(e,t){return Promise.resolve(["resolver is not defined",e,t].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},k=function(e,u){d(e,{path:t(i,O.path,e.path,u.path),export:t(i,O.export,e.export,u.export),resolver:t(r,O.resolver,e.resolver,u.resolver),extension:t(i,O.extension,e.extension,u.extension),withObject:t(o,O.withObject,e.withObject,u.withObject),rmWhitespace:t(o,O.rmWhitespace,e.rmWhitespace,u.rmWhitespace),cache:t(o,O.cache,e.cache,u.cache),token:d({},O.token,e.token,u.token),vars:d({},O.vars,e.vars,u.vars),globalHelpers:t(n,O.globalHelpers,e.globalHelpers,u.globalHelpers)})},F="undefined"!=typeof globalThis?globalThis:window||self;function S(e){if(!1===g(this,S))return new S;var t={enabled:!0,list:{}};this.configure=function(e){t.enabled=e.cache,!1===c&&this.load(F[e.export])},this.clear=function(){t.list={}},this.load=function(e){return t.enabled&&d(t.list,e||{}),this},this.get=function(e){if(t.enabled)return t.list[e]},this.set=function(e,n){return t.enabled&&(t.list[e]=n),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete t.list[e]},this.exist=function(e){return x(t.list,e)}}var P=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function B(e){if(!1===g(this,B))return new B(e);var t={};this.configure=function(e){t.withObject=e.withObject,t.rmWhitespace=e.rmWhitespace,t.token=e.token,t.vars=e.vars,t.globalHelpers=e.globalHelpers,t.matches=[],t.formats=[],t.slurp={match:"[ \\t]*",start:[t.token.start,"_"],end:["_",t.token.end]},P.forEach((function(e){t.matches.push(t.token.start.concat(e.symbol).concat(t.token.regex).concat(t.token.end)),t.formats.push(e.format.bind(t.vars))})),t.regex=new RegExp(t.matches.join("|").concat("|$"),"g"),t.slurpStart=new RegExp([t.slurp.match,t.slurp.start.join("")].join(""),"gm"),t.slurpEnd=new RegExp([t.slurp.end.join(""),t.slurp.match].join(""),"gm")},this.compile=function(e,n){var r=t.vars,i=r.SCOPE,o=r.SAFE,u=r.BUFFER,c=r.COMPONENT,l=t.globalHelpers;e=String(e),t.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(t.slurpStart,t.token.start).replace(t.slurpEnd,t.token.end);var s,f,p,b="".concat(u,"('");s=t.regex,f=function(n,r,i){b+=(""+e.slice(r,i)).replace(h,(function(e){return"\\"+a[e]})),n.forEach((function(e,n){e&&(b+=t.formats[n](e))}))},p=0,e.replace(s,(function(){var e=[].slice.call(arguments,0,-1),t=e.pop(),n=e.shift();return f(e,p,t),p=t+n.length,n})),b="try{".concat(b+="');","}catch(e){return ").concat(u,".error(e)}"),t.withObject&&(b="with(".concat(i,"){").concat(b,"}")),b="".concat(u,".start();").concat(b,"return ").concat(u,".end();"),b+="\n//# sourceURL=".concat(n);var g=null,v=[i,c,u,o].concat(l);try{(g=Function.apply(null,v.concat(b))).source="(function(".concat(v.join(","),"){\n").concat(b,"\n})")}catch(e){throw e.filename=n,e.source=b,e}return g},this.configure(e)}function T(e,t,n){if(!1===g(this,T))return new T(e,t,n);if(!1===g(t,S))throw new TypeError("cache is not instance of Cache");if(!1===g(n,B))throw new TypeError("compiler is not instance of Compiler");var i={},o=function(e){return i.resolver(i.path,e)};this.configure=function(e){i.path=e.path,i.cache=e.cache,r(e.resolver)&&(i.resolver=e.resolver)},this.get=function(e){return t.exist(e)?t.resolve(e):o(e).then((function(i){return function(e,n){return t.set(e,n),n}(e,function(e,t){return r(e)?e:n.compile(e,t)}(i,e))}))},this.configure(e)}function R(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],$=" ",A='"',C="/",U="<",M=">",H=function(e,t,n){var r=[],i=-1===N.indexOf(e),o=function(e,t){var n=[];return y(e,(function(e,r,i){var o=t(e,r,i);!1===u(o)&&n.push(o)})),n}(t,(function(e,t){if(null!=e)return[p(t),[A,p(e),A].join("")].join("=")})).join($);return r.push([U,e,$,o,M].join("")),n&&r.push(n instanceof Array?n.join(""):n),i&&r.push([U,C,e,M].join("")),r.join("")};function L(e){this.code=1,this.name="TemplateError",this.message=e,Error.call(this)}function W(e){L.call(this),this.code=404,this.name="TemplateNotFound",this.message=e}function J(e){L.call(this),this.code=500,this.name="TemplateSyntaxError",this.message=e}function q(e){return Promise.all(e||[]).then((function(e){return e.join("")}))}function D(){var e=[],t=[];function n(e){t.push(e)}return n.start=function(){t=[]},n.backup=function(){e.push(t.concat()),t=[]},n.restore=function(){var n=t.concat();return t=e.pop(),q(n)},n.error=function(e){return t=e,Promise.reject(new J(t.message));var t},n.end=function(){return q(t)},n}function K(e){if(!1===g(this,K))return new K(e);this.configure=function(e,t){var n,o=e.vars,u=o.BLOCKS,c=o.MACRO,a=o.EXTEND,l=o.LAYOUT,s=o.BUFFER,f=o.COMPONENT;function h(e){this[u]={},this[c]={},d(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){d(h.prototype,e||{})},h.prototype=d({},t||{}),Object.defineProperties(h.prototype,(R(n={},s,{value:D(),writable:!0,configurable:!1,enumerable:!1}),R(n,u,{value:{},writable:!0,configurable:!1,enumerable:!1}),R(n,c,{value:{},writable:!0,configurable:!1,enumerable:!1}),R(n,l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),R(n,a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),R(n,"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),R(n,"getBuffer",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),R(n,"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),R(n,"getBlocks",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),R(n,"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),R(n,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),R(n,"setLayout",{value:function(e){this[l]=e},writable:!1,configurable:!1,enumerable:!1}),R(n,"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),R(n,"clone",{value:function(e){var t=[l,a,s];return!0===e&&t.push(u),j(this,t)},writable:!1,configurable:!1,enumerable:!1}),R(n,"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),R(n,"echo",{value:function(e){var t=this.getBuffer();[].slice.call(arguments).forEach(t)},writable:!1,configurable:!1,enumerable:!1}),R(n,"fn",{value:function(e){var t=this.getBuffer(),n=this;return function(){return t.backup(),r(e)&&e.apply(n,arguments),t.restore()}},writable:!1,configurable:!1,enumerable:!1}),R(n,"get",{value:function(e,t){var n=v(this,e,!0),r=n.shift(),i=n.pop();return x(r,i)?r[i]:t},writable:!0,configurable:!0,enumerable:!1}),R(n,"set",{value:function(e,t){var n=v(this,e,!1),r=n.shift(),i=n.pop();return this.getExtend()&&x(r,i)?r[i]:r[i]=t},writable:!1,configurable:!1,enumerable:!1}),R(n,"macro",{value:function(e,t){var n=this.getMacro(),r=this.fn(t),i=this;n[e]=function(){return i.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),R(n,"call",{value:function(e){var t=this.getMacro()[e],n=[].slice.call(arguments,1);if(r(t))return t.apply(t,n)},writable:!1,configurable:!1,enumerable:!1}),R(n,"block",{value:function(e,t){var n=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(t)),!this.getExtend()){var i=Object.assign([],r[e]),o=function(){return i.shift()};this.echo(o()(function e(){var t=o();return t?function(){n.echo(t(e()))}:w}()))}},writable:!1,configurable:!1,enumerable:!1}),R(n,"include",{value:function(e,t,n){var r=!1===n?{}:this.clone(!0),i=d(r,t||{}),o=this.render(e,i);this.echo(o)},writable:!1,configurable:!1,enumerable:!1}),R(n,"use",{value:function(e,t){var n=this.require(e);this.echo(E(n,(function(e){var n=this.getMacro();y(e,(function(e,r){n[[t,r].join(".")]=e}))}),this))},writable:!1,configurable:!1,enumerable:!1}),R(n,"async",{value:function(e,t){this.echo(E(e,(function(e){return this.fn(t)(e)}),this))},writable:!1,configurable:!1,enumerable:!1}),R(n,"each",{value:function(e,t){i(e)&&(e=this.get(e,[])),y(e,t)},writable:!1,configurable:!1,enumerable:!1}),R(n,"element",{value:function(e,t,n){return H(e,t,n)},writable:!1,configurable:!1,enumerable:!1}),R(n,"el",{value:function(e,t,n){r(n)&&(n=this.fn(n)()),this.echo(E(n,(function(n){return this.element(e,t,n)}),this))},writable:!1,configurable:!1,enumerable:!1}),n))},this.configure(e)}Object.setPrototypeOf(W.prototype,Error.prototype),Object.setPrototypeOf(W.prototype,L.prototype),Object.setPrototypeOf(J.prototype,L.prototype);var X=new function e(t){if(!1===g(this,e))return new e(t);var n={},i={};k(i,t||{});var o=new K(i),u=new B(i),c=new S,a=new T(i,c,u),l=function(e,t){var n=i.globalHelpers,o=[t,t.getComponent(),t.getBuffer(),b].concat(n.filter((function(e){return r(t[e])})).map((function(e){return t[e].bind(t)})));return a.get(e).then((function(e){return e.apply(t,o)}))},s=function e(t,n){var r=m(t,i.extension),u=o.create(n);return l(r,u).then((function(t){if(u.getExtend()){u.setExtend(!1);var n=u.getLayout(),r=u.clone();return e(n,r)}return t}))};return this.configure=function(e){return k(i,e=e||{}),o.configure(i,n),u.configure(i),c.configure(i),a.configure(i),i},this.render=function(e,t){return s(e,t)},this.helpers=function(e){o.helpers(d(n,e))},this.preload=function(e){return c.load(e||{})},this.create=function(t){return new e(t)},this.compile=function(e,t){return u.compile(e,t)},this.context=function(e){return o.create(e)},this.helpers({require:function(e){var t=m(e,i.extension),n=o.create({});return l(t,n).then((function(){return n.getMacro()}))},render:s}),this}({resolver:function(e,t){return fetch(function(e,t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(e,t)).then((function(e){return e.text()}),(function(e){return new L(e)}))}}),Y=X.render,_=X.context,z=X.compile,G=X.helpers,I=X.preload,Q=X.configure,V=X.create;e.compile=z,e.configure=Q,e.context=_,e.create=V,e.helpers=G,e.preload=I,e.render=Y}));
package/dist/umd/index.js CHANGED
@@ -312,6 +312,7 @@
312
312
  BUFFER = _compiler$vars.BUFFER,
313
313
  COMPONENT = _compiler$vars.COMPONENT;
314
314
  var GLOBALS = compiler.globalHelpers;
315
+ content = String(content);
315
316
  if (compiler.rmWhitespace) {
316
317
  content = content.replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
317
318
  }
@@ -326,7 +327,7 @@
326
327
  });
327
328
  });
328
329
  source += "');";
329
- source = "try{".concat(source, "}catch(e){console.info(e)}");
330
+ source = "try{".concat(source, "}catch(e){return ").concat(BUFFER, ".error(e)}");
330
331
  if (compiler.withObject) {
331
332
  source = "with(".concat(SCOPE, "){").concat(source, "}");
332
333
  }
@@ -438,11 +439,36 @@
438
439
  return result.join('');
439
440
  };
440
441
 
442
+ function TemplateError(message) {
443
+ this.code = 1;
444
+ this.name = 'TemplateError';
445
+ this.message = message;
446
+ Error.call(this);
447
+ }
448
+ Object.setPrototypeOf(TemplateNotFound.prototype, Error.prototype);
449
+ function TemplateNotFound(message) {
450
+ TemplateError.call(this);
451
+ this.code = 404;
452
+ this.name = 'TemplateNotFound';
453
+ this.message = message;
454
+ }
455
+ Object.setPrototypeOf(TemplateNotFound.prototype, TemplateError.prototype);
456
+ function TemplateSyntaxError(message) {
457
+ TemplateError.call(this);
458
+ this.code = 500;
459
+ this.name = 'TemplateSyntaxError';
460
+ this.message = message;
461
+ }
462
+ Object.setPrototypeOf(TemplateSyntaxError.prototype, TemplateError.prototype);
463
+
441
464
  function resolve(list) {
442
465
  return Promise.all(list || []).then(function (list) {
443
466
  return list.join('');
444
467
  });
445
468
  }
469
+ function reject(error) {
470
+ return Promise.reject(new TemplateSyntaxError(error.message));
471
+ }
446
472
  function createBuffer() {
447
473
  var store = [],
448
474
  array = [];
@@ -462,7 +488,7 @@
462
488
  return resolve(result);
463
489
  };
464
490
  buffer.error = function (e) {
465
- throw e;
491
+ return reject(e);
466
492
  };
467
493
  buffer.end = function () {
468
494
  return resolve(array);
@@ -487,6 +513,11 @@
487
513
  this.helpers = function (methods) {
488
514
  extend(Scope.prototype, methods || {});
489
515
  };
516
+ /**
517
+ * @name ContextScope
518
+ * @param data
519
+ * @constructor
520
+ */
490
521
  function Scope(data) {
491
522
  this[BLOCKS] = {};
492
523
  this[MACRO] = {};
@@ -632,8 +663,8 @@
632
663
  var prop = path.pop();
633
664
  return hasProp(result, prop) ? result[prop] : defaults;
634
665
  },
635
- writable: false,
636
- configurable: false,
666
+ writable: true,
667
+ configurable: true,
637
668
  enumerable: false
638
669
  }), _defineProperty(_Object$definePropert, "set", {
639
670
  value: function value(name, _value2) {
@@ -773,13 +804,15 @@
773
804
  var compiler = new Compiler(config);
774
805
  var cache = new Cache();
775
806
  var template = new Template(config, cache, compiler);
776
- var output = function output(path, context) {
777
- var params = [context, context.getComponent(), context.getBuffer(), safeValue];
778
- config.globalHelpers.forEach(function (name) {
779
- if (isFunction(context[name])) params.push(context[name].bind(context));
780
- });
807
+ var output = function output(path, scope) {
808
+ var globalHelpers = config.globalHelpers;
809
+ var params = [scope, scope.getComponent(), scope.getBuffer(), safeValue].concat(globalHelpers.filter(function (name) {
810
+ return isFunction(scope[name]);
811
+ }).map(function (name) {
812
+ return scope[name].bind(scope);
813
+ }));
781
814
  return template.get(path).then(function (callback) {
782
- return callback.apply(context, params);
815
+ return callback.apply(scope, params);
783
816
  });
784
817
  };
785
818
  var require = function require(name) {
@@ -842,7 +875,7 @@
842
875
  return new Promise(function (resolve, reject) {
843
876
  path.readFile(joinPath(path$1, template), function (error, data) {
844
877
  if (error) {
845
- reject(error);
878
+ reject(new TemplateError(error));
846
879
  } else {
847
880
  resolve(data.toString());
848
881
  }
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var n=function(){var e=[].slice.call(arguments),n=e.shift();return e.filter(n).pop()},t=function(e){return Array.isArray(e)},r=function(e){return"function"==typeof e},i=function(e){return"string"==typeof e},o=function(e){return"boolean"==typeof e},u=function(e){return void 0===e},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a=function(){return c},l={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},f=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},h=f(s),p=f(l),b=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(h,(function(e){return s[e]}))},v=function(e){return(""+e).replace(p,(function(e){return"\\"+l[e]}))},g=function(e,n){var t=e;return null==t?"":!0===n?b(t):t},m=function(e,n){return Boolean(e instanceof n)},w=function(e,n,t){for(var i=e,o=String(n).split("."),u=o.pop(),c=0;c<o.length;c++){var a=o[c];if(r(i.toJSON)&&(i=i.toJSON()),t&&!1===i.hasOwnProperty(a)){i={};break}i=i[a]=i[a]||{}}return r(i.toJSON)&&(i=i.toJSON()),[i,u]},d=function(e,n){var t=e.split(".").pop();return t!==n&&(e=[e,n].join(".")),e},y=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return t.filter((function(e){return e})).reduce((function(e,n){return Object.assign(e,n)}),e)},j=function(){},E=function(e,n){var t;for(t in e)k(e,t)&&n(e[t],t,e)},x=function(e,n){return function(e,n,t){var r=e instanceof Array,i=r?[]:{};return E(e,(function(e,t,o){var c=n(e,t,o);!1===u(c)&&(r?i.push(c):i[t]=c)})),i}(e,(function(e,t){if(-1===n.indexOf(t))return e}))},O=function(e,n,t){return Promise.resolve(e).then(n.bind(t))},k=function(e,n){return e&&e.hasOwnProperty(n)},F={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(e,n){return Promise.resolve(["resolver is not defined",e,n].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},S=function(e,u){y(e,{path:n(i,F.path,e.path,u.path),export:n(i,F.export,e.export,u.export),resolver:n(r,F.resolver,e.resolver,u.resolver),extension:n(i,F.extension,e.extension,u.extension),withObject:n(o,F.withObject,e.withObject,u.withObject),rmWhitespace:n(o,F.rmWhitespace,e.rmWhitespace,u.rmWhitespace),cache:n(o,F.cache,e.cache,u.cache),token:y({},F.token,e.token,u.token),vars:y({},F.vars,e.vars,u.vars),globalHelpers:n(t,F.globalHelpers,e.globalHelpers,u.globalHelpers)})},B="undefined"!=typeof globalThis?globalThis:window||self;function P(e){if(!1===m(this,P))return new P;var n={enabled:!0,list:{}};this.configure=function(e){n.enabled=e.cache,!1===a()&&this.load(B[e.export])},this.clear=function(){n.list={}},this.load=function(e){return n.enabled&&y(n.list,e||{}),this},this.get=function(e){if(n.enabled)return n.list[e]},this.set=function(e,t){return n.enabled&&(n.list[e]=t),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete n.list[e]},this.exist=function(e){return k(n.list,e)}}var R=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function T(e){if(!1===m(this,T))return new T(e);var n={};this.configure=function(e){n.withObject=e.withObject,n.rmWhitespace=e.rmWhitespace,n.token=e.token,n.vars=e.vars,n.globalHelpers=e.globalHelpers,n.matches=[],n.formats=[],n.slurp={match:"[ \\t]*",start:[n.token.start,"_"],end:["_",n.token.end]},R.forEach((function(e){n.matches.push(n.token.start.concat(e.symbol).concat(n.token.regex).concat(n.token.end)),n.formats.push(e.format.bind(n.vars))})),n.regex=new RegExp(n.matches.join("|").concat("|$"),"g"),n.slurpStart=new RegExp([n.slurp.match,n.slurp.start.join("")].join(""),"gm"),n.slurpEnd=new RegExp([n.slurp.end.join(""),n.slurp.match].join(""),"gm")},this.compile=function(e,t){var r=n.vars,i=r.SCOPE,o=r.SAFE,u=r.BUFFER,c=r.COMPONENT,a=n.globalHelpers;n.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(n.slurpStart,n.token.start).replace(n.slurpEnd,n.token.end);var l,s,f,h="".concat(u,"('");l=n.regex,s=function(t,r,i){h+=v(e.slice(r,i)),t.forEach((function(e,t){e&&(h+=n.formats[t](e))}))},f=0,e.replace(l,(function(){var e=[].slice.call(arguments,0,-1),n=e.pop(),t=e.shift();return s(e,f,n),f=n+t.length,t})),h="try{".concat(h+="');","}catch(e){console.info(e)}"),n.withObject&&(h="with(".concat(i,"){").concat(h,"}")),h="".concat(u,".start();").concat(h,"return ").concat(u,".end();"),h+="\n//# sourceURL=".concat(t);var p=null,b=[i,c,u,o].concat(a);try{(p=Function.apply(null,b.concat(h))).source="(function(".concat(b.join(","),"){\n").concat(h,"\n})")}catch(e){throw e.filename=t,e.source=h,e}return p},this.configure(e)}function $(e,n,t){if(!1===m(this,$))return new $(e,n,t);if(!1===m(n,P))throw new TypeError("cache is not instance of Cache");if(!1===m(t,T))throw new TypeError("compiler is not instance of Compiler");var i={},o=function(e){return i.resolver(i.path,e)};this.configure=function(e){i.path=e.path,i.cache=e.cache,r(e.resolver)&&(i.resolver=e.resolver)},this.get=function(e){return n.exist(e)?n.resolve(e):o(e).then((function(i){return function(e,t){return n.set(e,t),t}(e,function(e,n){return r(e)?e:t.compile(e,n)}(i,e))}))},this.configure(e)}function A(e,n,t){return(n=function(e){var n=function(e,n){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:String(n)}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var C=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],N=" ",U='"',M="/",H="<",L=">",W=function(e,n,t){var r=[],i=-1===C.indexOf(e),o=function(e,n,t){var r=[];return E(e,(function(e,t,i){var o=n(e,t,i);!1===u(o)&&r.push(o)})),r}(n,(function(e,n){if(null!=e)return[b(n),[U,b(e),U].join("")].join("=")})).join(N);return r.push([H,e,N,o,L].join("")),t&&r.push(t instanceof Array?t.join(""):t),i&&r.push([H,M,e,L].join("")),r.join("")};function J(e){return Promise.all(e||[]).then((function(e){return e.join("")}))}function _(){var e=[],n=[];function t(e){n.push(e)}return t.start=function(){n=[]},t.backup=function(){e.push(n.concat()),n=[]},t.restore=function(){var t=n.concat();return n=e.pop(),J(t)},t.error=function(e){throw e},t.end=function(){return J(n)},t}function q(e){if(!1===m(this,q))return new q(e);this.configure=function(e,n){var t,o=e.vars,u=o.BLOCKS,c=o.MACRO,a=o.EXTEND,l=o.LAYOUT,s=o.BUFFER,f=o.COMPONENT;function h(e){this[u]={},this[c]={},y(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){y(h.prototype,e||{})},h.prototype=y({},n||{}),Object.defineProperties(h.prototype,(A(t={},s,{value:_(),writable:!0,configurable:!1,enumerable:!1}),A(t,u,{value:{},writable:!0,configurable:!1,enumerable:!1}),A(t,c,{value:{},writable:!0,configurable:!1,enumerable:!1}),A(t,l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),A(t,a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),A(t,"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),A(t,"getBuffer",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),A(t,"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),A(t,"getBlocks",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),A(t,"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),A(t,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),A(t,"setLayout",{value:function(e){this[l]=e},writable:!1,configurable:!1,enumerable:!1}),A(t,"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),A(t,"clone",{value:function(e){var n=[l,a,s];return!0===e&&n.push(u),x(this,n)},writable:!1,configurable:!1,enumerable:!1}),A(t,"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),A(t,"echo",{value:function(e){var n=this.getBuffer();[].slice.call(arguments).forEach(n)},writable:!1,configurable:!1,enumerable:!1}),A(t,"fn",{value:function(e){var n=this.getBuffer(),t=this;return function(){return n.backup(),r(e)&&e.apply(t,arguments),n.restore()}},writable:!1,configurable:!1,enumerable:!1}),A(t,"get",{value:function(e,n){var t=w(this,e,!0),r=t.shift(),i=t.pop();return k(r,i)?r[i]:n},writable:!1,configurable:!1,enumerable:!1}),A(t,"set",{value:function(e,n){var t=w(this,e,!1),r=t.shift(),i=t.pop();return this.getExtend()&&k(r,i)?r[i]:r[i]=n},writable:!1,configurable:!1,enumerable:!1}),A(t,"macro",{value:function(e,n){var t=this.getMacro(),r=this.fn(n),i=this;t[e]=function(){return i.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),A(t,"call",{value:function(e){var n=this.getMacro()[e],t=[].slice.call(arguments,1);if(r(n))return n.apply(n,t)},writable:!1,configurable:!1,enumerable:!1}),A(t,"block",{value:function(e,n){var t=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(n)),!this.getExtend()){var i=Object.assign([],r[e]),o=function(){return i.shift()};this.echo(o()(function e(){var n=o();return n?function(){t.echo(n(e()))}:j}()))}},writable:!1,configurable:!1,enumerable:!1}),A(t,"include",{value:function(e,n,t){var r=!1===t?{}:this.clone(!0),i=y(r,n||{}),o=this.render(e,i);this.echo(o)},writable:!1,configurable:!1,enumerable:!1}),A(t,"use",{value:function(e,n){var t=this.require(e);this.echo(O(t,(function(e){var t=this.getMacro();E(e,(function(e,r){t[[n,r].join(".")]=e}))}),this))},writable:!1,configurable:!1,enumerable:!1}),A(t,"async",{value:function(e,n){this.echo(O(e,(function(e){return this.fn(n)(e)}),this))},writable:!1,configurable:!1,enumerable:!1}),A(t,"each",{value:function(e,n){i(e)&&(e=this.get(e,[])),E(e,n)},writable:!1,configurable:!1,enumerable:!1}),A(t,"element",{value:function(e,n,t){return W(e,n,t)},writable:!1,configurable:!1,enumerable:!1}),A(t,"el",{value:function(e,n,t){r(t)&&(t=this.fn(t)()),this.echo(O(t,(function(t){return this.element(e,n,t)}),this))},writable:!1,configurable:!1,enumerable:!1}),t))},this.configure(e)}var D={};var K=new function e(n){if(!1===m(this,e))return new e(n);var t={},i={};S(i,n||{});var o=new q(i),u=new T(i),c=new P,a=new $(i,c,u),l=function(e,n){var t=[n,n.getComponent(),n.getBuffer(),g];return i.globalHelpers.forEach((function(e){r(n[e])&&t.push(n[e].bind(n))})),a.get(e).then((function(e){return e.apply(n,t)}))},s=function e(n,t){var r=d(n,i.extension),u=o.create(t);return l(r,u).then((function(n){if(u.getExtend()){u.setExtend(!1);var t=u.getLayout(),r=u.clone();return e(t,r)}return n}))};return this.configure=function(e){return S(i,e=e||{}),o.configure(i,t),u.configure(i),c.configure(i),a.configure(i),i},this.render=function(e,n){return s(e,n)},this.helpers=function(e){o.helpers(y(t,e))},this.preload=function(e){return c.load(e||{})},this.create=function(n){return new e(n)},this.compile=function(e,n){return u.compile(e,n)},this.context=function(e){return o.create(e)},this.helpers({require:function(e){var n=d(e,i.extension),t=o.create({});return l(n,t).then((function(){return t.getMacro()}))},render:s}),this}({resolver:function(e,n){return new Promise((function(t,r){D.readFile(function(e,n){return(n=[e,n].join("/")).replace(/\/\//g,"/")}(e,n),(function(e,n){e?r(e):t(n.toString())}))}))}}),X=K.render,Y=K.context,z=K.compile,G=K.helpers,I=K.preload,Q=K.configure,V=K.create,Z=function(e){return function(t,u,c){r(u)&&(c=u,u={});var a=y({},(u=u||{}).settings),l=n(i,F.path,a.views),s=n(o,F.cache,a["view cache"]),f=y({},a["view options"]),h=D.relative(l,t);return f.path=l,f.cache=s,e.configure(f),e.render(h,u).then((function(e){c(null,e)})).catch((function(e){c(e)}))}}(K);e.__express=Z,e.compile=z,e.configure=Q,e.context=Y,e.create=V,e.helpers=G,e.preload=I,e.render=X}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var t=function(){var e=[].slice.call(arguments),t=e.shift();return e.filter(t).pop()},n=function(e){return Array.isArray(e)},r=function(e){return"function"==typeof e},i=function(e){return"string"==typeof e},o=function(e){return"boolean"==typeof e},u=function(e){return void 0===e},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},s=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},f=s(l),h=s(a),p=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(f,(function(e){return l[e]}))},b=function(e,t){var n=e;return null==n?"":!0===t?p(n):n},v=function(e,t){return Boolean(e instanceof t)},g=function(e,t,n){for(var i=e,o=String(t).split("."),u=o.pop(),c=0;c<o.length;c++){var a=o[c];if(r(i.toJSON)&&(i=i.toJSON()),n&&!1===i.hasOwnProperty(a)){i={};break}i=i[a]=i[a]||{}}return r(i.toJSON)&&(i=i.toJSON()),[i,u]},m=function(e,t){var n=e.split(".").pop();return n!==t&&(e=[e,t].join(".")),e},d=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.filter((function(e){return e})).reduce((function(e,t){return Object.assign(e,t)}),e)},w=function(){},y=function(e,t){var n;for(n in e)x(e,n)&&t(e[n],n,e)},j=function(e,t){return function(e,t){var n=e instanceof Array,r=n?[]:{};return y(e,(function(e,i,o){var c=t(e,i,o);!1===u(c)&&(n?r.push(c):r[i]=c)})),r}(e,(function(e,n){if(-1===t.indexOf(n))return e}))},E=function(e,t,n){return Promise.resolve(e).then(t.bind(n))},x=function(e,t){return e&&e.hasOwnProperty(t)},O={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(e,t){return Promise.resolve(["resolver is not defined",e,t].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},F=function(e,u){d(e,{path:t(i,O.path,e.path,u.path),export:t(i,O.export,e.export,u.export),resolver:t(r,O.resolver,e.resolver,u.resolver),extension:t(i,O.extension,e.extension,u.extension),withObject:t(o,O.withObject,e.withObject,u.withObject),rmWhitespace:t(o,O.rmWhitespace,e.rmWhitespace,u.rmWhitespace),cache:t(o,O.cache,e.cache,u.cache),token:d({},O.token,e.token,u.token),vars:d({},O.vars,e.vars,u.vars),globalHelpers:t(n,O.globalHelpers,e.globalHelpers,u.globalHelpers)})},k="undefined"!=typeof globalThis?globalThis:window||self;function S(e){if(!1===v(this,S))return new S;var t={enabled:!0,list:{}};this.configure=function(e){t.enabled=e.cache,!1===c&&this.load(k[e.export])},this.clear=function(){t.list={}},this.load=function(e){return t.enabled&&d(t.list,e||{}),this},this.get=function(e){if(t.enabled)return t.list[e]},this.set=function(e,n){return t.enabled&&(t.list[e]=n),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete t.list[e]},this.exist=function(e){return x(t.list,e)}}var P=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function B(e){if(!1===v(this,B))return new B(e);var t={};this.configure=function(e){t.withObject=e.withObject,t.rmWhitespace=e.rmWhitespace,t.token=e.token,t.vars=e.vars,t.globalHelpers=e.globalHelpers,t.matches=[],t.formats=[],t.slurp={match:"[ \\t]*",start:[t.token.start,"_"],end:["_",t.token.end]},P.forEach((function(e){t.matches.push(t.token.start.concat(e.symbol).concat(t.token.regex).concat(t.token.end)),t.formats.push(e.format.bind(t.vars))})),t.regex=new RegExp(t.matches.join("|").concat("|$"),"g"),t.slurpStart=new RegExp([t.slurp.match,t.slurp.start.join("")].join(""),"gm"),t.slurpEnd=new RegExp([t.slurp.end.join(""),t.slurp.match].join(""),"gm")},this.compile=function(e,n){var r=t.vars,i=r.SCOPE,o=r.SAFE,u=r.BUFFER,c=r.COMPONENT,l=t.globalHelpers;e=String(e),t.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(t.slurpStart,t.token.start).replace(t.slurpEnd,t.token.end);var s,f,p,b="".concat(u,"('");s=t.regex,f=function(n,r,i){b+=(""+e.slice(r,i)).replace(h,(function(e){return"\\"+a[e]})),n.forEach((function(e,n){e&&(b+=t.formats[n](e))}))},p=0,e.replace(s,(function(){var e=[].slice.call(arguments,0,-1),t=e.pop(),n=e.shift();return f(e,p,t),p=t+n.length,n})),b="try{".concat(b+="');","}catch(e){return ").concat(u,".error(e)}"),t.withObject&&(b="with(".concat(i,"){").concat(b,"}")),b="".concat(u,".start();").concat(b,"return ").concat(u,".end();"),b+="\n//# sourceURL=".concat(n);var v=null,g=[i,c,u,o].concat(l);try{(v=Function.apply(null,g.concat(b))).source="(function(".concat(g.join(","),"){\n").concat(b,"\n})")}catch(e){throw e.filename=n,e.source=b,e}return v},this.configure(e)}function T(e,t,n){if(!1===v(this,T))return new T(e,t,n);if(!1===v(t,S))throw new TypeError("cache is not instance of Cache");if(!1===v(n,B))throw new TypeError("compiler is not instance of Compiler");var i={},o=function(e){return i.resolver(i.path,e)};this.configure=function(e){i.path=e.path,i.cache=e.cache,r(e.resolver)&&(i.resolver=e.resolver)},this.get=function(e){return t.exist(e)?t.resolve(e):o(e).then((function(i){return function(e,n){return t.set(e,n),n}(e,function(e,t){return r(e)?e:n.compile(e,t)}(i,e))}))},this.configure(e)}function R(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],$=" ",A='"',C="/",U="<",M=">",H=function(e,t,n){var r=[],i=-1===N.indexOf(e),o=function(e,t){var n=[];return y(e,(function(e,r,i){var o=t(e,r,i);!1===u(o)&&n.push(o)})),n}(t,(function(e,t){if(null!=e)return[p(t),[A,p(e),A].join("")].join("=")})).join($);return r.push([U,e,$,o,M].join("")),n&&r.push(n instanceof Array?n.join(""):n),i&&r.push([U,C,e,M].join("")),r.join("")};function L(e){this.code=1,this.name="TemplateError",this.message=e,Error.call(this)}function W(e){L.call(this),this.code=404,this.name="TemplateNotFound",this.message=e}function J(e){L.call(this),this.code=500,this.name="TemplateSyntaxError",this.message=e}function _(e){return Promise.all(e||[]).then((function(e){return e.join("")}))}function q(){var e=[],t=[];function n(e){t.push(e)}return n.start=function(){t=[]},n.backup=function(){e.push(t.concat()),t=[]},n.restore=function(){var n=t.concat();return t=e.pop(),_(n)},n.error=function(e){return t=e,Promise.reject(new J(t.message));var t},n.end=function(){return _(t)},n}function D(e){if(!1===v(this,D))return new D(e);this.configure=function(e,t){var n,o=e.vars,u=o.BLOCKS,c=o.MACRO,a=o.EXTEND,l=o.LAYOUT,s=o.BUFFER,f=o.COMPONENT;function h(e){this[u]={},this[c]={},d(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){d(h.prototype,e||{})},h.prototype=d({},t||{}),Object.defineProperties(h.prototype,(R(n={},s,{value:q(),writable:!0,configurable:!1,enumerable:!1}),R(n,u,{value:{},writable:!0,configurable:!1,enumerable:!1}),R(n,c,{value:{},writable:!0,configurable:!1,enumerable:!1}),R(n,l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),R(n,a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),R(n,"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),R(n,"getBuffer",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),R(n,"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),R(n,"getBlocks",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),R(n,"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),R(n,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),R(n,"setLayout",{value:function(e){this[l]=e},writable:!1,configurable:!1,enumerable:!1}),R(n,"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),R(n,"clone",{value:function(e){var t=[l,a,s];return!0===e&&t.push(u),j(this,t)},writable:!1,configurable:!1,enumerable:!1}),R(n,"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),R(n,"echo",{value:function(e){var t=this.getBuffer();[].slice.call(arguments).forEach(t)},writable:!1,configurable:!1,enumerable:!1}),R(n,"fn",{value:function(e){var t=this.getBuffer(),n=this;return function(){return t.backup(),r(e)&&e.apply(n,arguments),t.restore()}},writable:!1,configurable:!1,enumerable:!1}),R(n,"get",{value:function(e,t){var n=g(this,e,!0),r=n.shift(),i=n.pop();return x(r,i)?r[i]:t},writable:!0,configurable:!0,enumerable:!1}),R(n,"set",{value:function(e,t){var n=g(this,e,!1),r=n.shift(),i=n.pop();return this.getExtend()&&x(r,i)?r[i]:r[i]=t},writable:!1,configurable:!1,enumerable:!1}),R(n,"macro",{value:function(e,t){var n=this.getMacro(),r=this.fn(t),i=this;n[e]=function(){return i.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),R(n,"call",{value:function(e){var t=this.getMacro()[e],n=[].slice.call(arguments,1);if(r(t))return t.apply(t,n)},writable:!1,configurable:!1,enumerable:!1}),R(n,"block",{value:function(e,t){var n=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(t)),!this.getExtend()){var i=Object.assign([],r[e]),o=function(){return i.shift()};this.echo(o()(function e(){var t=o();return t?function(){n.echo(t(e()))}:w}()))}},writable:!1,configurable:!1,enumerable:!1}),R(n,"include",{value:function(e,t,n){var r=!1===n?{}:this.clone(!0),i=d(r,t||{}),o=this.render(e,i);this.echo(o)},writable:!1,configurable:!1,enumerable:!1}),R(n,"use",{value:function(e,t){var n=this.require(e);this.echo(E(n,(function(e){var n=this.getMacro();y(e,(function(e,r){n[[t,r].join(".")]=e}))}),this))},writable:!1,configurable:!1,enumerable:!1}),R(n,"async",{value:function(e,t){this.echo(E(e,(function(e){return this.fn(t)(e)}),this))},writable:!1,configurable:!1,enumerable:!1}),R(n,"each",{value:function(e,t){i(e)&&(e=this.get(e,[])),y(e,t)},writable:!1,configurable:!1,enumerable:!1}),R(n,"element",{value:function(e,t,n){return H(e,t,n)},writable:!1,configurable:!1,enumerable:!1}),R(n,"el",{value:function(e,t,n){r(n)&&(n=this.fn(n)()),this.echo(E(n,(function(n){return this.element(e,t,n)}),this))},writable:!1,configurable:!1,enumerable:!1}),n))},this.configure(e)}Object.setPrototypeOf(W.prototype,Error.prototype),Object.setPrototypeOf(W.prototype,L.prototype),Object.setPrototypeOf(J.prototype,L.prototype);var K={};var X=new function e(t){if(!1===v(this,e))return new e(t);var n={},i={};F(i,t||{});var o=new D(i),u=new B(i),c=new S,a=new T(i,c,u),l=function(e,t){var n=i.globalHelpers,o=[t,t.getComponent(),t.getBuffer(),b].concat(n.filter((function(e){return r(t[e])})).map((function(e){return t[e].bind(t)})));return a.get(e).then((function(e){return e.apply(t,o)}))},s=function e(t,n){var r=m(t,i.extension),u=o.create(n);return l(r,u).then((function(t){if(u.getExtend()){u.setExtend(!1);var n=u.getLayout(),r=u.clone();return e(n,r)}return t}))};return this.configure=function(e){return F(i,e=e||{}),o.configure(i,n),u.configure(i),c.configure(i),a.configure(i),i},this.render=function(e,t){return s(e,t)},this.helpers=function(e){o.helpers(d(n,e))},this.preload=function(e){return c.load(e||{})},this.create=function(t){return new e(t)},this.compile=function(e,t){return u.compile(e,t)},this.context=function(e){return o.create(e)},this.helpers({require:function(e){var t=m(e,i.extension),n=o.create({});return l(t,n).then((function(){return n.getMacro()}))},render:s}),this}({resolver:function(e,t){return new Promise((function(n,r){K.readFile(function(e,t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(e,t),(function(e,t){e?r(new L(e)):n(t.toString())}))}))}}),Y=X.render,z=X.context,G=X.compile,I=X.helpers,Q=X.preload,V=X.configure,Z=X.create,ee=function(e){return function(n,u,c){r(u)&&(c=u,u={});var a=d({},(u=u||{}).settings),l=t(i,O.path,a.views),s=t(o,O.cache,a["view cache"]),f=d({},a["view options"]),h=K.relative(l,n);return f.path=l,f.cache=s,e.configure(f),e.render(h,u).then((function(e){c(null,e)})).catch((function(e){c(e)}))}}(X);e.__express=ee,e.compile=G,e.configure=V,e.context=z,e.create=Z,e.helpers=I,e.preload=Q,e.render=Y}));