[Service] Integrate DeviceHome and SignalingServer
[platform/framework/web/wrtjs.git] / device_home / node_modules / ejs / ejs.js
1 (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ejs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2 /*
3  * EJS Embedded JavaScript templates
4  * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *         http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18 */
19
20 'use strict';
21
22 /**
23  * @file Embedded JavaScript templating engine. {@link http://ejs.co}
24  * @author Matthew Eernisse <mde@fleegix.org>
25  * @author Tiancheng "Timothy" Gu <timothygu99@gmail.com>
26  * @project EJS
27  * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
28  */
29
30 /**
31  * EJS internal functions.
32  *
33  * Technically this "module" lies in the same file as {@link module:ejs}, for
34  * the sake of organization all the private functions re grouped into this
35  * module.
36  *
37  * @module ejs-internal
38  * @private
39  */
40
41 /**
42  * Embedded JavaScript templating engine.
43  *
44  * @module ejs
45  * @public
46  */
47
48 var fs = require('fs');
49 var path = require('path');
50 var utils = require('./utils');
51
52 var scopeOptionWarned = false;
53 /** @type {string} */
54 var _VERSION_STRING = require('../package.json').version;
55 var _DEFAULT_OPEN_DELIMITER = '<';
56 var _DEFAULT_CLOSE_DELIMITER = '>';
57 var _DEFAULT_DELIMITER = '%';
58 var _DEFAULT_LOCALS_NAME = 'locals';
59 var _NAME = 'ejs';
60 var _REGEX_STRING = '(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)';
61 var _OPTS_PASSABLE_WITH_DATA = ['delimiter', 'scope', 'context', 'debug', 'compileDebug',
62   'client', '_with', 'rmWhitespace', 'strict', 'filename', 'async'];
63 // We don't allow 'cache' option to be passed in the data obj for
64 // the normal `render` call, but this is where Express 2 & 3 put it
65 // so we make an exception for `renderFile`
66 var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat('cache');
67 var _BOM = /^\uFEFF/;
68
69 /**
70  * EJS template function cache. This can be a LRU object from lru-cache NPM
71  * module. By default, it is {@link module:utils.cache}, a simple in-process
72  * cache that grows continuously.
73  *
74  * @type {Cache}
75  */
76
77 exports.cache = utils.cache;
78
79 /**
80  * Custom file loader. Useful for template preprocessing or restricting access
81  * to a certain part of the filesystem.
82  *
83  * @type {fileLoader}
84  */
85
86 exports.fileLoader = fs.readFileSync;
87
88 /**
89  * Name of the object containing the locals.
90  *
91  * This variable is overridden by {@link Options}`.localsName` if it is not
92  * `undefined`.
93  *
94  * @type {String}
95  * @public
96  */
97
98 exports.localsName = _DEFAULT_LOCALS_NAME;
99
100 /**
101  * Promise implementation -- defaults to the native implementation if available
102  * This is mostly just for testability
103  *
104  * @type {PromiseConstructorLike}
105  * @public
106  */
107
108 exports.promiseImpl = (new Function('return this;'))().Promise;
109
110 /**
111  * Get the path to the included file from the parent file path and the
112  * specified path.
113  *
114  * @param {String}  name     specified path
115  * @param {String}  filename parent file path
116  * @param {Boolean} [isDir=false] whether the parent file path is a directory
117  * @return {String}
118  */
119 exports.resolveInclude = function(name, filename, isDir) {
120   var dirname = path.dirname;
121   var extname = path.extname;
122   var resolve = path.resolve;
123   var includePath = resolve(isDir ? filename : dirname(filename), name);
124   var ext = extname(name);
125   if (!ext) {
126     includePath += '.ejs';
127   }
128   return includePath;
129 };
130
131 /**
132  * Try to resolve file path on multiple directories
133  *
134  * @param  {String}        name  specified path
135  * @param  {Array<String>} paths list of possible parent directory paths
136  * @return {String}
137  */
138 function resolvePaths(name, paths) {
139   var filePath;
140   if (paths.some(function (v) {
141     filePath = exports.resolveInclude(name, v, true);
142     return fs.existsSync(filePath);
143   })) {
144     return filePath;
145   }
146 }
147
148 /**
149  * Get the path to the included file by Options
150  *
151  * @param  {String}  path    specified path
152  * @param  {Options} options compilation options
153  * @return {String}
154  */
155 function getIncludePath(path, options) {
156   var includePath;
157   var filePath;
158   var views = options.views;
159   var match = /^[A-Za-z]+:\\|^\//.exec(path);
160
161   // Abs path
162   if (match && match.length) {
163     path = path.replace(/^\/*/, '');
164     if (Array.isArray(options.root)) {
165       includePath = resolvePaths(path, options.root);
166     } else {
167       includePath = exports.resolveInclude(path, options.root || '/', true);
168     }
169   }
170   // Relative paths
171   else {
172     // Look relative to a passed filename first
173     if (options.filename) {
174       filePath = exports.resolveInclude(path, options.filename);
175       if (fs.existsSync(filePath)) {
176         includePath = filePath;
177       }
178     }
179     // Then look in any views directories
180     if (!includePath && Array.isArray(views)) {
181       includePath = resolvePaths(path, views);
182     }
183     if (!includePath && typeof options.includer !== 'function') {
184       throw new Error('Could not find the include file "' +
185           options.escapeFunction(path) + '"');
186     }
187   }
188   return includePath;
189 }
190
191 /**
192  * Get the template from a string or a file, either compiled on-the-fly or
193  * read from cache (if enabled), and cache the template if needed.
194  *
195  * If `template` is not set, the file specified in `options.filename` will be
196  * read.
197  *
198  * If `options.cache` is true, this function reads the file from
199  * `options.filename` so it must be set prior to calling this function.
200  *
201  * @memberof module:ejs-internal
202  * @param {Options} options   compilation options
203  * @param {String} [template] template source
204  * @return {(TemplateFunction|ClientFunction)}
205  * Depending on the value of `options.client`, either type might be returned.
206  * @static
207  */
208
209 function handleCache(options, template) {
210   var func;
211   var filename = options.filename;
212   var hasTemplate = arguments.length > 1;
213
214   if (options.cache) {
215     if (!filename) {
216       throw new Error('cache option requires a filename');
217     }
218     func = exports.cache.get(filename);
219     if (func) {
220       return func;
221     }
222     if (!hasTemplate) {
223       template = fileLoader(filename).toString().replace(_BOM, '');
224     }
225   }
226   else if (!hasTemplate) {
227     // istanbul ignore if: should not happen at all
228     if (!filename) {
229       throw new Error('Internal EJS error: no file name or template '
230                     + 'provided');
231     }
232     template = fileLoader(filename).toString().replace(_BOM, '');
233   }
234   func = exports.compile(template, options);
235   if (options.cache) {
236     exports.cache.set(filename, func);
237   }
238   return func;
239 }
240
241 /**
242  * Try calling handleCache with the given options and data and call the
243  * callback with the result. If an error occurs, call the callback with
244  * the error. Used by renderFile().
245  *
246  * @memberof module:ejs-internal
247  * @param {Options} options    compilation options
248  * @param {Object} data        template data
249  * @param {RenderFileCallback} cb callback
250  * @static
251  */
252
253 function tryHandleCache(options, data, cb) {
254   var result;
255   if (!cb) {
256     if (typeof exports.promiseImpl == 'function') {
257       return new exports.promiseImpl(function (resolve, reject) {
258         try {
259           result = handleCache(options)(data);
260           resolve(result);
261         }
262         catch (err) {
263           reject(err);
264         }
265       });
266     }
267     else {
268       throw new Error('Please provide a callback function');
269     }
270   }
271   else {
272     try {
273       result = handleCache(options)(data);
274     }
275     catch (err) {
276       return cb(err);
277     }
278
279     cb(null, result);
280   }
281 }
282
283 /**
284  * fileLoader is independent
285  *
286  * @param {String} filePath ejs file path.
287  * @return {String} The contents of the specified file.
288  * @static
289  */
290
291 function fileLoader(filePath){
292   return exports.fileLoader(filePath);
293 }
294
295 /**
296  * Get the template function.
297  *
298  * If `options.cache` is `true`, then the template is cached.
299  *
300  * @memberof module:ejs-internal
301  * @param {String}  path    path for the specified file
302  * @param {Options} options compilation options
303  * @return {(TemplateFunction|ClientFunction)}
304  * Depending on the value of `options.client`, either type might be returned
305  * @static
306  */
307
308 function includeFile(path, options) {
309   var opts = utils.shallowCopy({}, options);
310   opts.filename = getIncludePath(path, opts);
311   if (typeof options.includer === 'function') {
312     var includerResult = options.includer(path, opts.filename);
313     if (includerResult) {
314       if (includerResult.filename) {
315         opts.filename = includerResult.filename;
316       }
317       if (includerResult.template) {
318         return handleCache(opts, includerResult.template);
319       }
320     }
321   }
322   return handleCache(opts);
323 }
324
325 /**
326  * Re-throw the given `err` in context to the `str` of ejs, `filename`, and
327  * `lineno`.
328  *
329  * @implements {RethrowCallback}
330  * @memberof module:ejs-internal
331  * @param {Error}  err      Error object
332  * @param {String} str      EJS source
333  * @param {String} flnm     file name of the EJS file
334  * @param {Number} lineno   line number of the error
335  * @param {EscapeCallback} esc
336  * @static
337  */
338
339 function rethrow(err, str, flnm, lineno, esc) {
340   var lines = str.split('\n');
341   var start = Math.max(lineno - 3, 0);
342   var end = Math.min(lines.length, lineno + 3);
343   var filename = esc(flnm);
344   // Error context
345   var context = lines.slice(start, end).map(function (line, i){
346     var curr = i + start + 1;
347     return (curr == lineno ? ' >> ' : '    ')
348       + curr
349       + '| '
350       + line;
351   }).join('\n');
352
353   // Alter exception message
354   err.path = filename;
355   err.message = (filename || 'ejs') + ':'
356     + lineno + '\n'
357     + context + '\n\n'
358     + err.message;
359
360   throw err;
361 }
362
363 function stripSemi(str){
364   return str.replace(/;(\s*$)/, '$1');
365 }
366
367 /**
368  * Compile the given `str` of ejs into a template function.
369  *
370  * @param {String}  template EJS template
371  *
372  * @param {Options} [opts] compilation options
373  *
374  * @return {(TemplateFunction|ClientFunction)}
375  * Depending on the value of `opts.client`, either type might be returned.
376  * Note that the return type of the function also depends on the value of `opts.async`.
377  * @public
378  */
379
380 exports.compile = function compile(template, opts) {
381   var templ;
382
383   // v1 compat
384   // 'scope' is 'context'
385   // FIXME: Remove this in a future version
386   if (opts && opts.scope) {
387     if (!scopeOptionWarned){
388       console.warn('`scope` option is deprecated and will be removed in EJS 3');
389       scopeOptionWarned = true;
390     }
391     if (!opts.context) {
392       opts.context = opts.scope;
393     }
394     delete opts.scope;
395   }
396   templ = new Template(template, opts);
397   return templ.compile();
398 };
399
400 /**
401  * Render the given `template` of ejs.
402  *
403  * If you would like to include options but not data, you need to explicitly
404  * call this function with `data` being an empty object or `null`.
405  *
406  * @param {String}   template EJS template
407  * @param {Object}  [data={}] template data
408  * @param {Options} [opts={}] compilation and rendering options
409  * @return {(String|Promise<String>)}
410  * Return value type depends on `opts.async`.
411  * @public
412  */
413
414 exports.render = function (template, d, o) {
415   var data = d || {};
416   var opts = o || {};
417
418   // No options object -- if there are optiony names
419   // in the data, copy them to options
420   if (arguments.length == 2) {
421     utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA);
422   }
423
424   return handleCache(opts, template)(data);
425 };
426
427 /**
428  * Render an EJS file at the given `path` and callback `cb(err, str)`.
429  *
430  * If you would like to include options but not data, you need to explicitly
431  * call this function with `data` being an empty object or `null`.
432  *
433  * @param {String}             path     path to the EJS file
434  * @param {Object}            [data={}] template data
435  * @param {Options}           [opts={}] compilation and rendering options
436  * @param {RenderFileCallback} cb callback
437  * @public
438  */
439
440 exports.renderFile = function () {
441   var args = Array.prototype.slice.call(arguments);
442   var filename = args.shift();
443   var cb;
444   var opts = {filename: filename};
445   var data;
446   var viewOpts;
447
448   // Do we have a callback?
449   if (typeof arguments[arguments.length - 1] == 'function') {
450     cb = args.pop();
451   }
452   // Do we have data/opts?
453   if (args.length) {
454     // Should always have data obj
455     data = args.shift();
456     // Normal passed opts (data obj + opts obj)
457     if (args.length) {
458       // Use shallowCopy so we don't pollute passed in opts obj with new vals
459       utils.shallowCopy(opts, args.pop());
460     }
461     // Special casing for Express (settings + opts-in-data)
462     else {
463       // Express 3 and 4
464       if (data.settings) {
465         // Pull a few things from known locations
466         if (data.settings.views) {
467           opts.views = data.settings.views;
468         }
469         if (data.settings['view cache']) {
470           opts.cache = true;
471         }
472         // Undocumented after Express 2, but still usable, esp. for
473         // items that are unsafe to be passed along with data, like `root`
474         viewOpts = data.settings['view options'];
475         if (viewOpts) {
476           utils.shallowCopy(opts, viewOpts);
477         }
478       }
479       // Express 2 and lower, values set in app.locals, or people who just
480       // want to pass options in their data. NOTE: These values will override
481       // anything previously set in settings  or settings['view options']
482       utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA_EXPRESS);
483     }
484     opts.filename = filename;
485   }
486   else {
487     data = {};
488   }
489
490   return tryHandleCache(opts, data, cb);
491 };
492
493 /**
494  * Clear intermediate JavaScript cache. Calls {@link Cache#reset}.
495  * @public
496  */
497
498 /**
499  * EJS template class
500  * @public
501  */
502 exports.Template = Template;
503
504 exports.clearCache = function () {
505   exports.cache.reset();
506 };
507
508 function Template(text, opts) {
509   opts = opts || {};
510   var options = {};
511   this.templateText = text;
512   /** @type {string | null} */
513   this.mode = null;
514   this.truncate = false;
515   this.currentLine = 1;
516   this.source = '';
517   options.client = opts.client || false;
518   options.escapeFunction = opts.escape || opts.escapeFunction || utils.escapeXML;
519   options.compileDebug = opts.compileDebug !== false;
520   options.debug = !!opts.debug;
521   options.filename = opts.filename;
522   options.openDelimiter = opts.openDelimiter || exports.openDelimiter || _DEFAULT_OPEN_DELIMITER;
523   options.closeDelimiter = opts.closeDelimiter || exports.closeDelimiter || _DEFAULT_CLOSE_DELIMITER;
524   options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER;
525   options.strict = opts.strict || false;
526   options.context = opts.context;
527   options.cache = opts.cache || false;
528   options.rmWhitespace = opts.rmWhitespace;
529   options.root = opts.root;
530   options.includer = opts.includer;
531   options.outputFunctionName = opts.outputFunctionName;
532   options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME;
533   options.views = opts.views;
534   options.async = opts.async;
535   options.destructuredLocals = opts.destructuredLocals;
536   options.legacyInclude = typeof opts.legacyInclude != 'undefined' ? !!opts.legacyInclude : true;
537
538   if (options.strict) {
539     options._with = false;
540   }
541   else {
542     options._with = typeof opts._with != 'undefined' ? opts._with : true;
543   }
544
545   this.opts = options;
546
547   this.regex = this.createRegex();
548 }
549
550 Template.modes = {
551   EVAL: 'eval',
552   ESCAPED: 'escaped',
553   RAW: 'raw',
554   COMMENT: 'comment',
555   LITERAL: 'literal'
556 };
557
558 Template.prototype = {
559   createRegex: function () {
560     var str = _REGEX_STRING;
561     var delim = utils.escapeRegExpChars(this.opts.delimiter);
562     var open = utils.escapeRegExpChars(this.opts.openDelimiter);
563     var close = utils.escapeRegExpChars(this.opts.closeDelimiter);
564     str = str.replace(/%/g, delim)
565       .replace(/</g, open)
566       .replace(/>/g, close);
567     return new RegExp(str);
568   },
569
570   compile: function () {
571     /** @type {string} */
572     var src;
573     /** @type {ClientFunction} */
574     var fn;
575     var opts = this.opts;
576     var prepended = '';
577     var appended = '';
578     /** @type {EscapeCallback} */
579     var escapeFn = opts.escapeFunction;
580     /** @type {FunctionConstructor} */
581     var ctor;
582     /** @type {string} */
583     var sanitizedFilename = opts.filename ? JSON.stringify(opts.filename) : 'undefined';
584
585     if (!this.source) {
586       this.generateSource();
587       prepended +=
588         '  var __output = "";\n' +
589         '  function __append(s) { if (s !== undefined && s !== null) __output += s }\n';
590       if (opts.outputFunctionName) {
591         prepended += '  var ' + opts.outputFunctionName + ' = __append;' + '\n';
592       }
593       if (opts.destructuredLocals && opts.destructuredLocals.length) {
594         var destructuring = '  var __locals = (' + opts.localsName + ' || {}),\n';
595         for (var i = 0; i < opts.destructuredLocals.length; i++) {
596           var name = opts.destructuredLocals[i];
597           if (i > 0) {
598             destructuring += ',\n  ';
599           }
600           destructuring += name + ' = __locals.' + name;
601         }
602         prepended += destructuring + ';\n';
603       }
604       if (opts._with !== false) {
605         prepended +=  '  with (' + opts.localsName + ' || {}) {' + '\n';
606         appended += '  }' + '\n';
607       }
608       appended += '  return __output;' + '\n';
609       this.source = prepended + this.source + appended;
610     }
611
612     if (opts.compileDebug) {
613       src = 'var __line = 1' + '\n'
614         + '  , __lines = ' + JSON.stringify(this.templateText) + '\n'
615         + '  , __filename = ' + sanitizedFilename + ';' + '\n'
616         + 'try {' + '\n'
617         + this.source
618         + '} catch (e) {' + '\n'
619         + '  rethrow(e, __lines, __filename, __line, escapeFn);' + '\n'
620         + '}' + '\n';
621     }
622     else {
623       src = this.source;
624     }
625
626     if (opts.client) {
627       src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src;
628       if (opts.compileDebug) {
629         src = 'rethrow = rethrow || ' + rethrow.toString() + ';' + '\n' + src;
630       }
631     }
632
633     if (opts.strict) {
634       src = '"use strict";\n' + src;
635     }
636     if (opts.debug) {
637       console.log(src);
638     }
639     if (opts.compileDebug && opts.filename) {
640       src = src + '\n'
641         + '//# sourceURL=' + sanitizedFilename + '\n';
642     }
643
644     try {
645       if (opts.async) {
646         // Have to use generated function for this, since in envs without support,
647         // it breaks in parsing
648         try {
649           ctor = (new Function('return (async function(){}).constructor;'))();
650         }
651         catch(e) {
652           if (e instanceof SyntaxError) {
653             throw new Error('This environment does not support async/await');
654           }
655           else {
656             throw e;
657           }
658         }
659       }
660       else {
661         ctor = Function;
662       }
663       fn = new ctor(opts.localsName + ', escapeFn, include, rethrow', src);
664     }
665     catch(e) {
666       // istanbul ignore else
667       if (e instanceof SyntaxError) {
668         if (opts.filename) {
669           e.message += ' in ' + opts.filename;
670         }
671         e.message += ' while compiling ejs\n\n';
672         e.message += 'If the above error is not helpful, you may want to try EJS-Lint:\n';
673         e.message += 'https://github.com/RyanZim/EJS-Lint';
674         if (!opts.async) {
675           e.message += '\n';
676           e.message += 'Or, if you meant to create an async function, pass `async: true` as an option.';
677         }
678       }
679       throw e;
680     }
681
682     // Return a callable function which will execute the function
683     // created by the source-code, with the passed data as locals
684     // Adds a local `include` function which allows full recursive include
685     var returnedFn = opts.client ? fn : function anonymous(data) {
686       var include = function (path, includeData) {
687         var d = utils.shallowCopy({}, data);
688         if (includeData) {
689           d = utils.shallowCopy(d, includeData);
690         }
691         return includeFile(path, opts)(d);
692       };
693       return fn.apply(opts.context, [data || {}, escapeFn, include, rethrow]);
694     };
695     if (opts.filename && typeof Object.defineProperty === 'function') {
696       var filename = opts.filename;
697       var basename = path.basename(filename, path.extname(filename));
698       try {
699         Object.defineProperty(returnedFn, 'name', {
700           value: basename,
701           writable: false,
702           enumerable: false,
703           configurable: true
704         });
705       } catch (e) {/* ignore */}
706     }
707     return returnedFn;
708   },
709
710   generateSource: function () {
711     var opts = this.opts;
712
713     if (opts.rmWhitespace) {
714       // Have to use two separate replace here as `^` and `$` operators don't
715       // work well with `\r` and empty lines don't work well with the `m` flag.
716       this.templateText =
717         this.templateText.replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
718     }
719
720     // Slurp spaces and tabs before <%_ and after _%>
721     this.templateText =
722       this.templateText.replace(/[ \t]*<%_/gm, '<%_').replace(/_%>[ \t]*/gm, '_%>');
723
724     var self = this;
725     var matches = this.parseTemplateText();
726     var d = this.opts.delimiter;
727     var o = this.opts.openDelimiter;
728     var c = this.opts.closeDelimiter;
729
730     if (matches && matches.length) {
731       matches.forEach(function (line, index) {
732         var closing;
733         // If this is an opening tag, check for closing tags
734         // FIXME: May end up with some false positives here
735         // Better to store modes as k/v with openDelimiter + delimiter as key
736         // Then this can simply check against the map
737         if ( line.indexOf(o + d) === 0        // If it is a tag
738           && line.indexOf(o + d + d) !== 0) { // and is not escaped
739           closing = matches[index + 2];
740           if (!(closing == d + c || closing == '-' + d + c || closing == '_' + d + c)) {
741             throw new Error('Could not find matching close tag for "' + line + '".');
742           }
743         }
744         self.scanLine(line);
745       });
746     }
747
748   },
749
750   parseTemplateText: function () {
751     var str = this.templateText;
752     var pat = this.regex;
753     var result = pat.exec(str);
754     var arr = [];
755     var firstPos;
756
757     while (result) {
758       firstPos = result.index;
759
760       if (firstPos !== 0) {
761         arr.push(str.substring(0, firstPos));
762         str = str.slice(firstPos);
763       }
764
765       arr.push(result[0]);
766       str = str.slice(result[0].length);
767       result = pat.exec(str);
768     }
769
770     if (str) {
771       arr.push(str);
772     }
773
774     return arr;
775   },
776
777   _addOutput: function (line) {
778     if (this.truncate) {
779       // Only replace single leading linebreak in the line after
780       // -%> tag -- this is the single, trailing linebreak
781       // after the tag that the truncation mode replaces
782       // Handle Win / Unix / old Mac linebreaks -- do the \r\n
783       // combo first in the regex-or
784       line = line.replace(/^(?:\r\n|\r|\n)/, '');
785       this.truncate = false;
786     }
787     if (!line) {
788       return line;
789     }
790
791     // Preserve literal slashes
792     line = line.replace(/\\/g, '\\\\');
793
794     // Convert linebreaks
795     line = line.replace(/\n/g, '\\n');
796     line = line.replace(/\r/g, '\\r');
797
798     // Escape double-quotes
799     // - this will be the delimiter during execution
800     line = line.replace(/"/g, '\\"');
801     this.source += '    ; __append("' + line + '")' + '\n';
802   },
803
804   scanLine: function (line) {
805     var self = this;
806     var d = this.opts.delimiter;
807     var o = this.opts.openDelimiter;
808     var c = this.opts.closeDelimiter;
809     var newLineCount = 0;
810
811     newLineCount = (line.split('\n').length - 1);
812
813     switch (line) {
814     case o + d:
815     case o + d + '_':
816       this.mode = Template.modes.EVAL;
817       break;
818     case o + d + '=':
819       this.mode = Template.modes.ESCAPED;
820       break;
821     case o + d + '-':
822       this.mode = Template.modes.RAW;
823       break;
824     case o + d + '#':
825       this.mode = Template.modes.COMMENT;
826       break;
827     case o + d + d:
828       this.mode = Template.modes.LITERAL;
829       this.source += '    ; __append("' + line.replace(o + d + d, o + d) + '")' + '\n';
830       break;
831     case d + d + c:
832       this.mode = Template.modes.LITERAL;
833       this.source += '    ; __append("' + line.replace(d + d + c, d + c) + '")' + '\n';
834       break;
835     case d + c:
836     case '-' + d + c:
837     case '_' + d + c:
838       if (this.mode == Template.modes.LITERAL) {
839         this._addOutput(line);
840       }
841
842       this.mode = null;
843       this.truncate = line.indexOf('-') === 0 || line.indexOf('_') === 0;
844       break;
845     default:
846       // In script mode, depends on type of tag
847       if (this.mode) {
848         // If '//' is found without a line break, add a line break.
849         switch (this.mode) {
850         case Template.modes.EVAL:
851         case Template.modes.ESCAPED:
852         case Template.modes.RAW:
853           if (line.lastIndexOf('//') > line.lastIndexOf('\n')) {
854             line += '\n';
855           }
856         }
857         switch (this.mode) {
858         // Just executing code
859         case Template.modes.EVAL:
860           this.source += '    ; ' + line + '\n';
861           break;
862           // Exec, esc, and output
863         case Template.modes.ESCAPED:
864           this.source += '    ; __append(escapeFn(' + stripSemi(line) + '))' + '\n';
865           break;
866           // Exec and output
867         case Template.modes.RAW:
868           this.source += '    ; __append(' + stripSemi(line) + ')' + '\n';
869           break;
870         case Template.modes.COMMENT:
871           // Do nothing
872           break;
873           // Literal <%% mode, append as raw output
874         case Template.modes.LITERAL:
875           this._addOutput(line);
876           break;
877         }
878       }
879       // In string mode, just add the output
880       else {
881         this._addOutput(line);
882       }
883     }
884
885     if (self.opts.compileDebug && newLineCount) {
886       this.currentLine += newLineCount;
887       this.source += '    ; __line = ' + this.currentLine + '\n';
888     }
889   }
890 };
891
892 /**
893  * Escape characters reserved in XML.
894  *
895  * This is simply an export of {@link module:utils.escapeXML}.
896  *
897  * If `markup` is `undefined` or `null`, the empty string is returned.
898  *
899  * @param {String} markup Input string
900  * @return {String} Escaped string
901  * @public
902  * @func
903  * */
904 exports.escapeXML = utils.escapeXML;
905
906 /**
907  * Express.js support.
908  *
909  * This is an alias for {@link module:ejs.renderFile}, in order to support
910  * Express.js out-of-the-box.
911  *
912  * @func
913  */
914
915 exports.__express = exports.renderFile;
916
917 /**
918  * Version of EJS.
919  *
920  * @readonly
921  * @type {String}
922  * @public
923  */
924
925 exports.VERSION = _VERSION_STRING;
926
927 /**
928  * Name for detection of EJS.
929  *
930  * @readonly
931  * @type {String}
932  * @public
933  */
934
935 exports.name = _NAME;
936
937 /* istanbul ignore if */
938 if (typeof window != 'undefined') {
939   window.ejs = exports;
940 }
941
942 },{"../package.json":6,"./utils":2,"fs":3,"path":4}],2:[function(require,module,exports){
943 /*
944  * EJS Embedded JavaScript templates
945  * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
946  *
947  * Licensed under the Apache License, Version 2.0 (the "License");
948  * you may not use this file except in compliance with the License.
949  * You may obtain a copy of the License at
950  *
951  *         http://www.apache.org/licenses/LICENSE-2.0
952  *
953  * Unless required by applicable law or agreed to in writing, software
954  * distributed under the License is distributed on an "AS IS" BASIS,
955  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
956  * See the License for the specific language governing permissions and
957  * limitations under the License.
958  *
959 */
960
961 /**
962  * Private utility functions
963  * @module utils
964  * @private
965  */
966
967 'use strict';
968
969 var regExpChars = /[|\\{}()[\]^$+*?.]/g;
970
971 /**
972  * Escape characters reserved in regular expressions.
973  *
974  * If `string` is `undefined` or `null`, the empty string is returned.
975  *
976  * @param {String} string Input string
977  * @return {String} Escaped string
978  * @static
979  * @private
980  */
981 exports.escapeRegExpChars = function (string) {
982   // istanbul ignore if
983   if (!string) {
984     return '';
985   }
986   return String(string).replace(regExpChars, '\\$&');
987 };
988
989 var _ENCODE_HTML_RULES = {
990   '&': '&amp;',
991   '<': '&lt;',
992   '>': '&gt;',
993   '"': '&#34;',
994   "'": '&#39;'
995 };
996 var _MATCH_HTML = /[&<>'"]/g;
997
998 function encode_char(c) {
999   return _ENCODE_HTML_RULES[c] || c;
1000 }
1001
1002 /**
1003  * Stringified version of constants used by {@link module:utils.escapeXML}.
1004  *
1005  * It is used in the process of generating {@link ClientFunction}s.
1006  *
1007  * @readonly
1008  * @type {String}
1009  */
1010
1011 var escapeFuncStr =
1012   'var _ENCODE_HTML_RULES = {\n'
1013 + '      "&": "&amp;"\n'
1014 + '    , "<": "&lt;"\n'
1015 + '    , ">": "&gt;"\n'
1016 + '    , \'"\': "&#34;"\n'
1017 + '    , "\'": "&#39;"\n'
1018 + '    }\n'
1019 + '  , _MATCH_HTML = /[&<>\'"]/g;\n'
1020 + 'function encode_char(c) {\n'
1021 + '  return _ENCODE_HTML_RULES[c] || c;\n'
1022 + '};\n';
1023
1024 /**
1025  * Escape characters reserved in XML.
1026  *
1027  * If `markup` is `undefined` or `null`, the empty string is returned.
1028  *
1029  * @implements {EscapeCallback}
1030  * @param {String} markup Input string
1031  * @return {String} Escaped string
1032  * @static
1033  * @private
1034  */
1035
1036 exports.escapeXML = function (markup) {
1037   return markup == undefined
1038     ? ''
1039     : String(markup)
1040       .replace(_MATCH_HTML, encode_char);
1041 };
1042 exports.escapeXML.toString = function () {
1043   return Function.prototype.toString.call(this) + ';\n' + escapeFuncStr;
1044 };
1045
1046 /**
1047  * Naive copy of properties from one object to another.
1048  * Does not recurse into non-scalar properties
1049  * Does not check to see if the property has a value before copying
1050  *
1051  * @param  {Object} to   Destination object
1052  * @param  {Object} from Source object
1053  * @return {Object}      Destination object
1054  * @static
1055  * @private
1056  */
1057 exports.shallowCopy = function (to, from) {
1058   from = from || {};
1059   for (var p in from) {
1060     to[p] = from[p];
1061   }
1062   return to;
1063 };
1064
1065 /**
1066  * Naive copy of a list of key names, from one object to another.
1067  * Only copies property if it is actually defined
1068  * Does not recurse into non-scalar properties
1069  *
1070  * @param  {Object} to   Destination object
1071  * @param  {Object} from Source object
1072  * @param  {Array} list List of properties to copy
1073  * @return {Object}      Destination object
1074  * @static
1075  * @private
1076  */
1077 exports.shallowCopyFromList = function (to, from, list) {
1078   for (var i = 0; i < list.length; i++) {
1079     var p = list[i];
1080     if (typeof from[p] != 'undefined') {
1081       to[p] = from[p];
1082     }
1083   }
1084   return to;
1085 };
1086
1087 /**
1088  * Simple in-process cache implementation. Does not implement limits of any
1089  * sort.
1090  *
1091  * @implements {Cache}
1092  * @static
1093  * @private
1094  */
1095 exports.cache = {
1096   _data: {},
1097   set: function (key, val) {
1098     this._data[key] = val;
1099   },
1100   get: function (key) {
1101     return this._data[key];
1102   },
1103   remove: function (key) {
1104     delete this._data[key];
1105   },
1106   reset: function () {
1107     this._data = {};
1108   }
1109 };
1110
1111 /**
1112  * Transforms hyphen case variable into camel case.
1113  *
1114  * @param {String} string Hyphen case string
1115  * @return {String} Camel case string
1116  * @static
1117  * @private
1118  */
1119 exports.hyphenToCamel = function (str) {
1120   return str.replace(/-[a-z]/g, function (match) { return match[1].toUpperCase(); });
1121 };
1122
1123 },{}],3:[function(require,module,exports){
1124
1125 },{}],4:[function(require,module,exports){
1126 (function (process){
1127 // .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
1128 // backported and transplited with Babel, with backwards-compat fixes
1129
1130 // Copyright Joyent, Inc. and other Node contributors.
1131 //
1132 // Permission is hereby granted, free of charge, to any person obtaining a
1133 // copy of this software and associated documentation files (the
1134 // "Software"), to deal in the Software without restriction, including
1135 // without limitation the rights to use, copy, modify, merge, publish,
1136 // distribute, sublicense, and/or sell copies of the Software, and to permit
1137 // persons to whom the Software is furnished to do so, subject to the
1138 // following conditions:
1139 //
1140 // The above copyright notice and this permission notice shall be included
1141 // in all copies or substantial portions of the Software.
1142 //
1143 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1144 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1145 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1146 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1147 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1148 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1149 // USE OR OTHER DEALINGS IN THE SOFTWARE.
1150
1151 // resolves . and .. elements in a path array with directory names there
1152 // must be no slashes, empty elements, or device names (c:\) in the array
1153 // (so also no leading and trailing slashes - it does not distinguish
1154 // relative and absolute paths)
1155 function normalizeArray(parts, allowAboveRoot) {
1156   // if the path tries to go above the root, `up` ends up > 0
1157   var up = 0;
1158   for (var i = parts.length - 1; i >= 0; i--) {
1159     var last = parts[i];
1160     if (last === '.') {
1161       parts.splice(i, 1);
1162     } else if (last === '..') {
1163       parts.splice(i, 1);
1164       up++;
1165     } else if (up) {
1166       parts.splice(i, 1);
1167       up--;
1168     }
1169   }
1170
1171   // if the path is allowed to go above the root, restore leading ..s
1172   if (allowAboveRoot) {
1173     for (; up--; up) {
1174       parts.unshift('..');
1175     }
1176   }
1177
1178   return parts;
1179 }
1180
1181 // path.resolve([from ...], to)
1182 // posix version
1183 exports.resolve = function() {
1184   var resolvedPath = '',
1185       resolvedAbsolute = false;
1186
1187   for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
1188     var path = (i >= 0) ? arguments[i] : process.cwd();
1189
1190     // Skip empty and invalid entries
1191     if (typeof path !== 'string') {
1192       throw new TypeError('Arguments to path.resolve must be strings');
1193     } else if (!path) {
1194       continue;
1195     }
1196
1197     resolvedPath = path + '/' + resolvedPath;
1198     resolvedAbsolute = path.charAt(0) === '/';
1199   }
1200
1201   // At this point the path should be resolved to a full absolute path, but
1202   // handle relative paths to be safe (might happen when process.cwd() fails)
1203
1204   // Normalize the path
1205   resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
1206     return !!p;
1207   }), !resolvedAbsolute).join('/');
1208
1209   return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
1210 };
1211
1212 // path.normalize(path)
1213 // posix version
1214 exports.normalize = function(path) {
1215   var isAbsolute = exports.isAbsolute(path),
1216       trailingSlash = substr(path, -1) === '/';
1217
1218   // Normalize the path
1219   path = normalizeArray(filter(path.split('/'), function(p) {
1220     return !!p;
1221   }), !isAbsolute).join('/');
1222
1223   if (!path && !isAbsolute) {
1224     path = '.';
1225   }
1226   if (path && trailingSlash) {
1227     path += '/';
1228   }
1229
1230   return (isAbsolute ? '/' : '') + path;
1231 };
1232
1233 // posix version
1234 exports.isAbsolute = function(path) {
1235   return path.charAt(0) === '/';
1236 };
1237
1238 // posix version
1239 exports.join = function() {
1240   var paths = Array.prototype.slice.call(arguments, 0);
1241   return exports.normalize(filter(paths, function(p, index) {
1242     if (typeof p !== 'string') {
1243       throw new TypeError('Arguments to path.join must be strings');
1244     }
1245     return p;
1246   }).join('/'));
1247 };
1248
1249
1250 // path.relative(from, to)
1251 // posix version
1252 exports.relative = function(from, to) {
1253   from = exports.resolve(from).substr(1);
1254   to = exports.resolve(to).substr(1);
1255
1256   function trim(arr) {
1257     var start = 0;
1258     for (; start < arr.length; start++) {
1259       if (arr[start] !== '') break;
1260     }
1261
1262     var end = arr.length - 1;
1263     for (; end >= 0; end--) {
1264       if (arr[end] !== '') break;
1265     }
1266
1267     if (start > end) return [];
1268     return arr.slice(start, end - start + 1);
1269   }
1270
1271   var fromParts = trim(from.split('/'));
1272   var toParts = trim(to.split('/'));
1273
1274   var length = Math.min(fromParts.length, toParts.length);
1275   var samePartsLength = length;
1276   for (var i = 0; i < length; i++) {
1277     if (fromParts[i] !== toParts[i]) {
1278       samePartsLength = i;
1279       break;
1280     }
1281   }
1282
1283   var outputParts = [];
1284   for (var i = samePartsLength; i < fromParts.length; i++) {
1285     outputParts.push('..');
1286   }
1287
1288   outputParts = outputParts.concat(toParts.slice(samePartsLength));
1289
1290   return outputParts.join('/');
1291 };
1292
1293 exports.sep = '/';
1294 exports.delimiter = ':';
1295
1296 exports.dirname = function (path) {
1297   if (typeof path !== 'string') path = path + '';
1298   if (path.length === 0) return '.';
1299   var code = path.charCodeAt(0);
1300   var hasRoot = code === 47 /*/*/;
1301   var end = -1;
1302   var matchedSlash = true;
1303   for (var i = path.length - 1; i >= 1; --i) {
1304     code = path.charCodeAt(i);
1305     if (code === 47 /*/*/) {
1306         if (!matchedSlash) {
1307           end = i;
1308           break;
1309         }
1310       } else {
1311       // We saw the first non-path separator
1312       matchedSlash = false;
1313     }
1314   }
1315
1316   if (end === -1) return hasRoot ? '/' : '.';
1317   if (hasRoot && end === 1) {
1318     // return '//';
1319     // Backwards-compat fix:
1320     return '/';
1321   }
1322   return path.slice(0, end);
1323 };
1324
1325 function basename(path) {
1326   if (typeof path !== 'string') path = path + '';
1327
1328   var start = 0;
1329   var end = -1;
1330   var matchedSlash = true;
1331   var i;
1332
1333   for (i = path.length - 1; i >= 0; --i) {
1334     if (path.charCodeAt(i) === 47 /*/*/) {
1335         // If we reached a path separator that was not part of a set of path
1336         // separators at the end of the string, stop now
1337         if (!matchedSlash) {
1338           start = i + 1;
1339           break;
1340         }
1341       } else if (end === -1) {
1342       // We saw the first non-path separator, mark this as the end of our
1343       // path component
1344       matchedSlash = false;
1345       end = i + 1;
1346     }
1347   }
1348
1349   if (end === -1) return '';
1350   return path.slice(start, end);
1351 }
1352
1353 // Uses a mixed approach for backwards-compatibility, as ext behavior changed
1354 // in new Node.js versions, so only basename() above is backported here
1355 exports.basename = function (path, ext) {
1356   var f = basename(path);
1357   if (ext && f.substr(-1 * ext.length) === ext) {
1358     f = f.substr(0, f.length - ext.length);
1359   }
1360   return f;
1361 };
1362
1363 exports.extname = function (path) {
1364   if (typeof path !== 'string') path = path + '';
1365   var startDot = -1;
1366   var startPart = 0;
1367   var end = -1;
1368   var matchedSlash = true;
1369   // Track the state of characters (if any) we see before our first dot and
1370   // after any path separator we find
1371   var preDotState = 0;
1372   for (var i = path.length - 1; i >= 0; --i) {
1373     var code = path.charCodeAt(i);
1374     if (code === 47 /*/*/) {
1375         // If we reached a path separator that was not part of a set of path
1376         // separators at the end of the string, stop now
1377         if (!matchedSlash) {
1378           startPart = i + 1;
1379           break;
1380         }
1381         continue;
1382       }
1383     if (end === -1) {
1384       // We saw the first non-path separator, mark this as the end of our
1385       // extension
1386       matchedSlash = false;
1387       end = i + 1;
1388     }
1389     if (code === 46 /*.*/) {
1390         // If this is our first dot, mark it as the start of our extension
1391         if (startDot === -1)
1392           startDot = i;
1393         else if (preDotState !== 1)
1394           preDotState = 1;
1395     } else if (startDot !== -1) {
1396       // We saw a non-dot and non-path separator before our dot, so we should
1397       // have a good chance at having a non-empty extension
1398       preDotState = -1;
1399     }
1400   }
1401
1402   if (startDot === -1 || end === -1 ||
1403       // We saw a non-dot character immediately before the dot
1404       preDotState === 0 ||
1405       // The (right-most) trimmed path component is exactly '..'
1406       preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
1407     return '';
1408   }
1409   return path.slice(startDot, end);
1410 };
1411
1412 function filter (xs, f) {
1413     if (xs.filter) return xs.filter(f);
1414     var res = [];
1415     for (var i = 0; i < xs.length; i++) {
1416         if (f(xs[i], i, xs)) res.push(xs[i]);
1417     }
1418     return res;
1419 }
1420
1421 // String.prototype.substr - negative index don't work in IE8
1422 var substr = 'ab'.substr(-1) === 'b'
1423     ? function (str, start, len) { return str.substr(start, len) }
1424     : function (str, start, len) {
1425         if (start < 0) start = str.length + start;
1426         return str.substr(start, len);
1427     }
1428 ;
1429
1430 }).call(this,require('_process'))
1431 },{"_process":5}],5:[function(require,module,exports){
1432 // shim for using process in browser
1433 var process = module.exports = {};
1434
1435 // cached from whatever global is present so that test runners that stub it
1436 // don't break things.  But we need to wrap it in a try catch in case it is
1437 // wrapped in strict mode code which doesn't define any globals.  It's inside a
1438 // function because try/catches deoptimize in certain engines.
1439
1440 var cachedSetTimeout;
1441 var cachedClearTimeout;
1442
1443 function defaultSetTimout() {
1444     throw new Error('setTimeout has not been defined');
1445 }
1446 function defaultClearTimeout () {
1447     throw new Error('clearTimeout has not been defined');
1448 }
1449 (function () {
1450     try {
1451         if (typeof setTimeout === 'function') {
1452             cachedSetTimeout = setTimeout;
1453         } else {
1454             cachedSetTimeout = defaultSetTimout;
1455         }
1456     } catch (e) {
1457         cachedSetTimeout = defaultSetTimout;
1458     }
1459     try {
1460         if (typeof clearTimeout === 'function') {
1461             cachedClearTimeout = clearTimeout;
1462         } else {
1463             cachedClearTimeout = defaultClearTimeout;
1464         }
1465     } catch (e) {
1466         cachedClearTimeout = defaultClearTimeout;
1467     }
1468 } ())
1469 function runTimeout(fun) {
1470     if (cachedSetTimeout === setTimeout) {
1471         //normal enviroments in sane situations
1472         return setTimeout(fun, 0);
1473     }
1474     // if setTimeout wasn't available but was latter defined
1475     if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
1476         cachedSetTimeout = setTimeout;
1477         return setTimeout(fun, 0);
1478     }
1479     try {
1480         // when when somebody has screwed with setTimeout but no I.E. maddness
1481         return cachedSetTimeout(fun, 0);
1482     } catch(e){
1483         try {
1484             // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1485             return cachedSetTimeout.call(null, fun, 0);
1486         } catch(e){
1487             // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
1488             return cachedSetTimeout.call(this, fun, 0);
1489         }
1490     }
1491
1492
1493 }
1494 function runClearTimeout(marker) {
1495     if (cachedClearTimeout === clearTimeout) {
1496         //normal enviroments in sane situations
1497         return clearTimeout(marker);
1498     }
1499     // if clearTimeout wasn't available but was latter defined
1500     if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
1501         cachedClearTimeout = clearTimeout;
1502         return clearTimeout(marker);
1503     }
1504     try {
1505         // when when somebody has screwed with setTimeout but no I.E. maddness
1506         return cachedClearTimeout(marker);
1507     } catch (e){
1508         try {
1509             // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
1510             return cachedClearTimeout.call(null, marker);
1511         } catch (e){
1512             // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
1513             // Some versions of I.E. have different rules for clearTimeout vs setTimeout
1514             return cachedClearTimeout.call(this, marker);
1515         }
1516     }
1517
1518
1519
1520 }
1521 var queue = [];
1522 var draining = false;
1523 var currentQueue;
1524 var queueIndex = -1;
1525
1526 function cleanUpNextTick() {
1527     if (!draining || !currentQueue) {
1528         return;
1529     }
1530     draining = false;
1531     if (currentQueue.length) {
1532         queue = currentQueue.concat(queue);
1533     } else {
1534         queueIndex = -1;
1535     }
1536     if (queue.length) {
1537         drainQueue();
1538     }
1539 }
1540
1541 function drainQueue() {
1542     if (draining) {
1543         return;
1544     }
1545     var timeout = runTimeout(cleanUpNextTick);
1546     draining = true;
1547
1548     var len = queue.length;
1549     while(len) {
1550         currentQueue = queue;
1551         queue = [];
1552         while (++queueIndex < len) {
1553             if (currentQueue) {
1554                 currentQueue[queueIndex].run();
1555             }
1556         }
1557         queueIndex = -1;
1558         len = queue.length;
1559     }
1560     currentQueue = null;
1561     draining = false;
1562     runClearTimeout(timeout);
1563 }
1564
1565 process.nextTick = function (fun) {
1566     var args = new Array(arguments.length - 1);
1567     if (arguments.length > 1) {
1568         for (var i = 1; i < arguments.length; i++) {
1569             args[i - 1] = arguments[i];
1570         }
1571     }
1572     queue.push(new Item(fun, args));
1573     if (queue.length === 1 && !draining) {
1574         runTimeout(drainQueue);
1575     }
1576 };
1577
1578 // v8 likes predictible objects
1579 function Item(fun, array) {
1580     this.fun = fun;
1581     this.array = array;
1582 }
1583 Item.prototype.run = function () {
1584     this.fun.apply(null, this.array);
1585 };
1586 process.title = 'browser';
1587 process.browser = true;
1588 process.env = {};
1589 process.argv = [];
1590 process.version = ''; // empty string to avoid regexp issues
1591 process.versions = {};
1592
1593 function noop() {}
1594
1595 process.on = noop;
1596 process.addListener = noop;
1597 process.once = noop;
1598 process.off = noop;
1599 process.removeListener = noop;
1600 process.removeAllListeners = noop;
1601 process.emit = noop;
1602 process.prependListener = noop;
1603 process.prependOnceListener = noop;
1604
1605 process.listeners = function (name) { return [] }
1606
1607 process.binding = function (name) {
1608     throw new Error('process.binding is not supported');
1609 };
1610
1611 process.cwd = function () { return '/' };
1612 process.chdir = function (dir) {
1613     throw new Error('process.chdir is not supported');
1614 };
1615 process.umask = function() { return 0; };
1616
1617 },{}],6:[function(require,module,exports){
1618 module.exports={
1619   "name": "ejs",
1620   "description": "Embedded JavaScript templates",
1621   "keywords": [
1622     "template",
1623     "engine",
1624     "ejs"
1625   ],
1626   "version": "3.1.6",
1627   "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",
1628   "license": "Apache-2.0",
1629   "bin": {
1630     "ejs": "./bin/cli.js"
1631   },
1632   "main": "./lib/ejs.js",
1633   "jsdelivr": "ejs.min.js",
1634   "unpkg": "ejs.min.js",
1635   "repository": {
1636     "type": "git",
1637     "url": "git://github.com/mde/ejs.git"
1638   },
1639   "bugs": "https://github.com/mde/ejs/issues",
1640   "homepage": "https://github.com/mde/ejs",
1641   "dependencies": {
1642     "jake": "^10.6.1"
1643   },
1644   "devDependencies": {
1645     "browserify": "^16.5.1",
1646     "eslint": "^6.8.0",
1647     "git-directory-deploy": "^1.5.1",
1648     "jsdoc": "^3.6.4",
1649     "lru-cache": "^4.0.1",
1650     "mocha": "^7.1.1",
1651     "uglify-js": "^3.3.16"
1652   },
1653   "engines": {
1654     "node": ">=0.10.0"
1655   },
1656   "scripts": {
1657     "test": "mocha"
1658   }
1659 }
1660
1661 },{}]},{},[1])(1)
1662 });