@dryfeld/nunjucks-loader 4.0.4 → 4.0.6

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.
@@ -0,0 +1,3450 @@
1
+ /*! Browser bundle of nunjucks 3.2.4 (slim, only works with precompiled templates) */
2
+ (function webpackUniversalModuleDefinition(root, factory) {
3
+ if(typeof exports === 'object' && typeof module === 'object')
4
+ module.exports = factory();
5
+ else if(typeof define === 'function' && define.amd)
6
+ define([], factory);
7
+ else if(typeof exports === 'object')
8
+ exports["nunjucks"] = factory();
9
+ else
10
+ root["nunjucks"] = factory();
11
+ })(self, function() {
12
+ return /******/ (function() { // webpackBootstrap
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ "./node_modules/a-sync-waterfall/index.js":
16
+ /*!************************************************!*\
17
+ !*** ./node_modules/a-sync-waterfall/index.js ***!
18
+ \************************************************/
19
+ /***/ (function(module, exports) {
20
+
21
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// MIT license (by Elan Shanker).
22
+ (function(globals) {
23
+ 'use strict';
24
+
25
+ var executeSync = function(){
26
+ var args = Array.prototype.slice.call(arguments);
27
+ if (typeof args[0] === 'function'){
28
+ args[0].apply(null, args.splice(1));
29
+ }
30
+ };
31
+
32
+ var executeAsync = function(fn){
33
+ if (typeof setImmediate === 'function') {
34
+ setImmediate(fn);
35
+ } else if (typeof process !== 'undefined' && process.nextTick) {
36
+ process.nextTick(fn);
37
+ } else {
38
+ setTimeout(fn, 0);
39
+ }
40
+ };
41
+
42
+ var makeIterator = function (tasks) {
43
+ var makeCallback = function (index) {
44
+ var fn = function () {
45
+ if (tasks.length) {
46
+ tasks[index].apply(null, arguments);
47
+ }
48
+ return fn.next();
49
+ };
50
+ fn.next = function () {
51
+ return (index < tasks.length - 1) ? makeCallback(index + 1): null;
52
+ };
53
+ return fn;
54
+ };
55
+ return makeCallback(0);
56
+ };
57
+
58
+ var _isArray = Array.isArray || function(maybeArray){
59
+ return Object.prototype.toString.call(maybeArray) === '[object Array]';
60
+ };
61
+
62
+ var waterfall = function (tasks, callback, forceAsync) {
63
+ var nextTick = forceAsync ? executeAsync : executeSync;
64
+ callback = callback || function () {};
65
+ if (!_isArray(tasks)) {
66
+ var err = new Error('First argument to waterfall must be an array of functions');
67
+ return callback(err);
68
+ }
69
+ if (!tasks.length) {
70
+ return callback();
71
+ }
72
+ var wrapIterator = function (iterator) {
73
+ return function (err) {
74
+ if (err) {
75
+ callback.apply(null, arguments);
76
+ callback = function () {};
77
+ } else {
78
+ var args = Array.prototype.slice.call(arguments, 1);
79
+ var next = iterator.next();
80
+ if (next) {
81
+ args.push(wrapIterator(next));
82
+ } else {
83
+ args.push(callback);
84
+ }
85
+ nextTick(function () {
86
+ iterator.apply(null, args);
87
+ });
88
+ }
89
+ };
90
+ };
91
+ wrapIterator(makeIterator(tasks))();
92
+ };
93
+
94
+ if (true) {
95
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
96
+ return waterfall;
97
+ }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
98
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); // RequireJS
99
+ } else // removed by dead control flow
100
+ {}
101
+ })(this);
102
+
103
+
104
+ /***/ }),
105
+
106
+ /***/ "./node_modules/asap/browser-asap.js":
107
+ /*!*******************************************!*\
108
+ !*** ./node_modules/asap/browser-asap.js ***!
109
+ \*******************************************/
110
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
111
+
112
+ "use strict";
113
+
114
+
115
+ // rawAsap provides everything we need except exception management.
116
+ var rawAsap = __webpack_require__(/*! ./raw */ "./node_modules/asap/browser-raw.js");
117
+ // RawTasks are recycled to reduce GC churn.
118
+ var freeTasks = [];
119
+ // We queue errors to ensure they are thrown in right order (FIFO).
120
+ // Array-as-queue is good enough here, since we are just dealing with exceptions.
121
+ var pendingErrors = [];
122
+ var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);
123
+
124
+ function throwFirstError() {
125
+ if (pendingErrors.length) {
126
+ throw pendingErrors.shift();
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Calls a task as soon as possible after returning, in its own event, with priority
132
+ * over other events like animation, reflow, and repaint. An error thrown from an
133
+ * event will not interrupt, nor even substantially slow down the processing of
134
+ * other events, but will be rather postponed to a lower priority event.
135
+ * @param {{call}} task A callable object, typically a function that takes no
136
+ * arguments.
137
+ */
138
+ module.exports = asap;
139
+ function asap(task) {
140
+ var rawTask;
141
+ if (freeTasks.length) {
142
+ rawTask = freeTasks.pop();
143
+ } else {
144
+ rawTask = new RawTask();
145
+ }
146
+ rawTask.task = task;
147
+ rawAsap(rawTask);
148
+ }
149
+
150
+ // We wrap tasks with recyclable task objects. A task object implements
151
+ // `call`, just like a function.
152
+ function RawTask() {
153
+ this.task = null;
154
+ }
155
+
156
+ // The sole purpose of wrapping the task is to catch the exception and recycle
157
+ // the task object after its single use.
158
+ RawTask.prototype.call = function () {
159
+ try {
160
+ this.task.call();
161
+ } catch (error) {
162
+ if (asap.onerror) {
163
+ // This hook exists purely for testing purposes.
164
+ // Its name will be periodically randomized to break any code that
165
+ // depends on its existence.
166
+ asap.onerror(error);
167
+ } else {
168
+ // In a web browser, exceptions are not fatal. However, to avoid
169
+ // slowing down the queue of pending tasks, we rethrow the error in a
170
+ // lower priority turn.
171
+ pendingErrors.push(error);
172
+ requestErrorThrow();
173
+ }
174
+ } finally {
175
+ this.task = null;
176
+ freeTasks[freeTasks.length] = this;
177
+ }
178
+ };
179
+
180
+
181
+ /***/ }),
182
+
183
+ /***/ "./node_modules/asap/browser-raw.js":
184
+ /*!******************************************!*\
185
+ !*** ./node_modules/asap/browser-raw.js ***!
186
+ \******************************************/
187
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
188
+
189
+ "use strict";
190
+
191
+
192
+ // Use the fastest means possible to execute a task in its own turn, with
193
+ // priority over other events including IO, animation, reflow, and redraw
194
+ // events in browsers.
195
+ //
196
+ // An exception thrown by a task will permanently interrupt the processing of
197
+ // subsequent tasks. The higher level `asap` function ensures that if an
198
+ // exception is thrown by a task, that the task queue will continue flushing as
199
+ // soon as possible, but if you use `rawAsap` directly, you are responsible to
200
+ // either ensure that no exceptions are thrown from your task, or to manually
201
+ // call `rawAsap.requestFlush` if an exception is thrown.
202
+ module.exports = rawAsap;
203
+ function rawAsap(task) {
204
+ if (!queue.length) {
205
+ requestFlush();
206
+ flushing = true;
207
+ }
208
+ // Equivalent to push, but avoids a function call.
209
+ queue[queue.length] = task;
210
+ }
211
+
212
+ var queue = [];
213
+ // Once a flush has been requested, no further calls to `requestFlush` are
214
+ // necessary until the next `flush` completes.
215
+ var flushing = false;
216
+ // `requestFlush` is an implementation-specific method that attempts to kick
217
+ // off a `flush` event as quickly as possible. `flush` will attempt to exhaust
218
+ // the event queue before yielding to the browser's own event loop.
219
+ var requestFlush;
220
+ // The position of the next task to execute in the task queue. This is
221
+ // preserved between calls to `flush` so that it can be resumed if
222
+ // a task throws an exception.
223
+ var index = 0;
224
+ // If a task schedules additional tasks recursively, the task queue can grow
225
+ // unbounded. To prevent memory exhaustion, the task queue will periodically
226
+ // truncate already-completed tasks.
227
+ var capacity = 1024;
228
+
229
+ // The flush function processes all tasks that have been scheduled with
230
+ // `rawAsap` unless and until one of those tasks throws an exception.
231
+ // If a task throws an exception, `flush` ensures that its state will remain
232
+ // consistent and will resume where it left off when called again.
233
+ // However, `flush` does not make any arrangements to be called again if an
234
+ // exception is thrown.
235
+ function flush() {
236
+ while (index < queue.length) {
237
+ var currentIndex = index;
238
+ // Advance the index before calling the task. This ensures that we will
239
+ // begin flushing on the next task the task throws an error.
240
+ index = index + 1;
241
+ queue[currentIndex].call();
242
+ // Prevent leaking memory for long chains of recursive calls to `asap`.
243
+ // If we call `asap` within tasks scheduled by `asap`, the queue will
244
+ // grow, but to avoid an O(n) walk for every task we execute, we don't
245
+ // shift tasks off the queue after they have been executed.
246
+ // Instead, we periodically shift 1024 tasks off the queue.
247
+ if (index > capacity) {
248
+ // Manually shift all values starting at the index back to the
249
+ // beginning of the queue.
250
+ for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
251
+ queue[scan] = queue[scan + index];
252
+ }
253
+ queue.length -= index;
254
+ index = 0;
255
+ }
256
+ }
257
+ queue.length = 0;
258
+ index = 0;
259
+ flushing = false;
260
+ }
261
+
262
+ // `requestFlush` is implemented using a strategy based on data collected from
263
+ // every available SauceLabs Selenium web driver worker at time of writing.
264
+ // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
265
+
266
+ // Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
267
+ // have WebKitMutationObserver but not un-prefixed MutationObserver.
268
+ // Must use `global` or `self` instead of `window` to work in both frames and web
269
+ // workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
270
+
271
+ /* globals self */
272
+ var scope = typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : self;
273
+ var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;
274
+
275
+ // MutationObservers are desirable because they have high priority and work
276
+ // reliably everywhere they are implemented.
277
+ // They are implemented in all modern browsers.
278
+ //
279
+ // - Android 4-4.3
280
+ // - Chrome 26-34
281
+ // - Firefox 14-29
282
+ // - Internet Explorer 11
283
+ // - iPad Safari 6-7.1
284
+ // - iPhone Safari 7-7.1
285
+ // - Safari 6-7
286
+ if (typeof BrowserMutationObserver === "function") {
287
+ requestFlush = makeRequestCallFromMutationObserver(flush);
288
+
289
+ // MessageChannels are desirable because they give direct access to the HTML
290
+ // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
291
+ // 11-12, and in web workers in many engines.
292
+ // Although message channels yield to any queued rendering and IO tasks, they
293
+ // would be better than imposing the 4ms delay of timers.
294
+ // However, they do not work reliably in Internet Explorer or Safari.
295
+
296
+ // Internet Explorer 10 is the only browser that has setImmediate but does
297
+ // not have MutationObservers.
298
+ // Although setImmediate yields to the browser's renderer, it would be
299
+ // preferrable to falling back to setTimeout since it does not have
300
+ // the minimum 4ms penalty.
301
+ // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
302
+ // Desktop to a lesser extent) that renders both setImmediate and
303
+ // MessageChannel useless for the purposes of ASAP.
304
+ // https://github.com/kriskowal/q/issues/396
305
+
306
+ // Timers are implemented universally.
307
+ // We fall back to timers in workers in most engines, and in foreground
308
+ // contexts in the following browsers.
309
+ // However, note that even this simple case requires nuances to operate in a
310
+ // broad spectrum of browsers.
311
+ //
312
+ // - Firefox 3-13
313
+ // - Internet Explorer 6-9
314
+ // - iPad Safari 4.3
315
+ // - Lynx 2.8.7
316
+ } else {
317
+ requestFlush = makeRequestCallFromTimer(flush);
318
+ }
319
+
320
+ // `requestFlush` requests that the high priority event queue be flushed as
321
+ // soon as possible.
322
+ // This is useful to prevent an error thrown in a task from stalling the event
323
+ // queue if the exception handled by Node.js’s
324
+ // `process.on("uncaughtException")` or by a domain.
325
+ rawAsap.requestFlush = requestFlush;
326
+
327
+ // To request a high priority event, we induce a mutation observer by toggling
328
+ // the text of a text node between "1" and "-1".
329
+ function makeRequestCallFromMutationObserver(callback) {
330
+ var toggle = 1;
331
+ var observer = new BrowserMutationObserver(callback);
332
+ var node = document.createTextNode("");
333
+ observer.observe(node, {characterData: true});
334
+ return function requestCall() {
335
+ toggle = -toggle;
336
+ node.data = toggle;
337
+ };
338
+ }
339
+
340
+ // The message channel technique was discovered by Malte Ubl and was the
341
+ // original foundation for this library.
342
+ // http://www.nonblocking.io/2011/06/windownexttick.html
343
+
344
+ // Safari 6.0.5 (at least) intermittently fails to create message ports on a
345
+ // page's first load. Thankfully, this version of Safari supports
346
+ // MutationObservers, so we don't need to fall back in that case.
347
+
348
+ // function makeRequestCallFromMessageChannel(callback) {
349
+ // var channel = new MessageChannel();
350
+ // channel.port1.onmessage = callback;
351
+ // return function requestCall() {
352
+ // channel.port2.postMessage(0);
353
+ // };
354
+ // }
355
+
356
+ // For reasons explained above, we are also unable to use `setImmediate`
357
+ // under any circumstances.
358
+ // Even if we were, there is another bug in Internet Explorer 10.
359
+ // It is not sufficient to assign `setImmediate` to `requestFlush` because
360
+ // `setImmediate` must be called *by name* and therefore must be wrapped in a
361
+ // closure.
362
+ // Never forget.
363
+
364
+ // function makeRequestCallFromSetImmediate(callback) {
365
+ // return function requestCall() {
366
+ // setImmediate(callback);
367
+ // };
368
+ // }
369
+
370
+ // Safari 6.0 has a problem where timers will get lost while the user is
371
+ // scrolling. This problem does not impact ASAP because Safari 6.0 supports
372
+ // mutation observers, so that implementation is used instead.
373
+ // However, if we ever elect to use timers in Safari, the prevalent work-around
374
+ // is to add a scroll event listener that calls for a flush.
375
+
376
+ // `setTimeout` does not call the passed callback if the delay is less than
377
+ // approximately 7 in web workers in Firefox 8 through 18, and sometimes not
378
+ // even then.
379
+
380
+ function makeRequestCallFromTimer(callback) {
381
+ return function requestCall() {
382
+ // We dispatch a timeout with a specified delay of 0 for engines that
383
+ // can reliably accommodate that request. This will usually be snapped
384
+ // to a 4 milisecond delay, but once we're flushing, there's no delay
385
+ // between events.
386
+ var timeoutHandle = setTimeout(handleTimer, 0);
387
+ // However, since this timer gets frequently dropped in Firefox
388
+ // workers, we enlist an interval handle that will try to fire
389
+ // an event 20 times per second until it succeeds.
390
+ var intervalHandle = setInterval(handleTimer, 50);
391
+
392
+ function handleTimer() {
393
+ // Whichever timer succeeds will cancel both timers and
394
+ // execute the callback.
395
+ clearTimeout(timeoutHandle);
396
+ clearInterval(intervalHandle);
397
+ callback();
398
+ }
399
+ };
400
+ }
401
+
402
+ // This is for `asap.js` only.
403
+ // Its name will be periodically randomized to break any code that depends on
404
+ // its existence.
405
+ rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;
406
+
407
+ // ASAP was originally a nextTick shim included in Q. This was factored out
408
+ // into this ASAP package. It was later adapted to RSVP which made further
409
+ // amendments. These decisions, particularly to marginalize MessageChannel and
410
+ // to capture the MutationObserver implementation in a closure, were integrated
411
+ // back into ASAP proper.
412
+ // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
413
+
414
+
415
+ /***/ }),
416
+
417
+ /***/ "./node_modules/events/events.js":
418
+ /*!***************************************!*\
419
+ !*** ./node_modules/events/events.js ***!
420
+ \***************************************/
421
+ /***/ (function(module) {
422
+
423
+ // Copyright Joyent, Inc. and other Node contributors.
424
+ //
425
+ // Permission is hereby granted, free of charge, to any person obtaining a
426
+ // copy of this software and associated documentation files (the
427
+ // "Software"), to deal in the Software without restriction, including
428
+ // without limitation the rights to use, copy, modify, merge, publish,
429
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
430
+ // persons to whom the Software is furnished to do so, subject to the
431
+ // following conditions:
432
+ //
433
+ // The above copyright notice and this permission notice shall be included
434
+ // in all copies or substantial portions of the Software.
435
+ //
436
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
437
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
438
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
439
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
440
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
441
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
442
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
443
+
444
+ function EventEmitter() {
445
+ this._events = this._events || {};
446
+ this._maxListeners = this._maxListeners || undefined;
447
+ }
448
+ module.exports = EventEmitter;
449
+
450
+ // Backwards-compat with node 0.10.x
451
+ EventEmitter.EventEmitter = EventEmitter;
452
+
453
+ EventEmitter.prototype._events = undefined;
454
+ EventEmitter.prototype._maxListeners = undefined;
455
+
456
+ // By default EventEmitters will print a warning if more than 10 listeners are
457
+ // added to it. This is a useful default which helps finding memory leaks.
458
+ EventEmitter.defaultMaxListeners = 10;
459
+
460
+ // Obviously not all Emitters should be limited to 10. This function allows
461
+ // that to be increased. Set to zero for unlimited.
462
+ EventEmitter.prototype.setMaxListeners = function(n) {
463
+ if (!isNumber(n) || n < 0 || isNaN(n))
464
+ throw TypeError('n must be a positive number');
465
+ this._maxListeners = n;
466
+ return this;
467
+ };
468
+
469
+ EventEmitter.prototype.emit = function(type) {
470
+ var er, handler, len, args, i, listeners;
471
+
472
+ if (!this._events)
473
+ this._events = {};
474
+
475
+ // If there is no 'error' event listener then throw.
476
+ if (type === 'error') {
477
+ if (!this._events.error ||
478
+ (isObject(this._events.error) && !this._events.error.length)) {
479
+ er = arguments[1];
480
+ if (er instanceof Error) {
481
+ throw er; // Unhandled 'error' event
482
+ } else {
483
+ // At least give some kind of context to the user
484
+ var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
485
+ err.context = er;
486
+ throw err;
487
+ }
488
+ }
489
+ }
490
+
491
+ handler = this._events[type];
492
+
493
+ if (isUndefined(handler))
494
+ return false;
495
+
496
+ if (isFunction(handler)) {
497
+ switch (arguments.length) {
498
+ // fast cases
499
+ case 1:
500
+ handler.call(this);
501
+ break;
502
+ case 2:
503
+ handler.call(this, arguments[1]);
504
+ break;
505
+ case 3:
506
+ handler.call(this, arguments[1], arguments[2]);
507
+ break;
508
+ // slower
509
+ default:
510
+ args = Array.prototype.slice.call(arguments, 1);
511
+ handler.apply(this, args);
512
+ }
513
+ } else if (isObject(handler)) {
514
+ args = Array.prototype.slice.call(arguments, 1);
515
+ listeners = handler.slice();
516
+ len = listeners.length;
517
+ for (i = 0; i < len; i++)
518
+ listeners[i].apply(this, args);
519
+ }
520
+
521
+ return true;
522
+ };
523
+
524
+ EventEmitter.prototype.addListener = function(type, listener) {
525
+ var m;
526
+
527
+ if (!isFunction(listener))
528
+ throw TypeError('listener must be a function');
529
+
530
+ if (!this._events)
531
+ this._events = {};
532
+
533
+ // To avoid recursion in the case that type === "newListener"! Before
534
+ // adding it to the listeners, first emit "newListener".
535
+ if (this._events.newListener)
536
+ this.emit('newListener', type,
537
+ isFunction(listener.listener) ?
538
+ listener.listener : listener);
539
+
540
+ if (!this._events[type])
541
+ // Optimize the case of one listener. Don't need the extra array object.
542
+ this._events[type] = listener;
543
+ else if (isObject(this._events[type]))
544
+ // If we've already got an array, just append.
545
+ this._events[type].push(listener);
546
+ else
547
+ // Adding the second element, need to change to array.
548
+ this._events[type] = [this._events[type], listener];
549
+
550
+ // Check for listener leak
551
+ if (isObject(this._events[type]) && !this._events[type].warned) {
552
+ if (!isUndefined(this._maxListeners)) {
553
+ m = this._maxListeners;
554
+ } else {
555
+ m = EventEmitter.defaultMaxListeners;
556
+ }
557
+
558
+ if (m && m > 0 && this._events[type].length > m) {
559
+ this._events[type].warned = true;
560
+ console.error('(node) warning: possible EventEmitter memory ' +
561
+ 'leak detected. %d listeners added. ' +
562
+ 'Use emitter.setMaxListeners() to increase limit.',
563
+ this._events[type].length);
564
+ if (typeof console.trace === 'function') {
565
+ // not supported in IE 10
566
+ console.trace();
567
+ }
568
+ }
569
+ }
570
+
571
+ return this;
572
+ };
573
+
574
+ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
575
+
576
+ EventEmitter.prototype.once = function(type, listener) {
577
+ if (!isFunction(listener))
578
+ throw TypeError('listener must be a function');
579
+
580
+ var fired = false;
581
+
582
+ function g() {
583
+ this.removeListener(type, g);
584
+
585
+ if (!fired) {
586
+ fired = true;
587
+ listener.apply(this, arguments);
588
+ }
589
+ }
590
+
591
+ g.listener = listener;
592
+ this.on(type, g);
593
+
594
+ return this;
595
+ };
596
+
597
+ // emits a 'removeListener' event iff the listener was removed
598
+ EventEmitter.prototype.removeListener = function(type, listener) {
599
+ var list, position, length, i;
600
+
601
+ if (!isFunction(listener))
602
+ throw TypeError('listener must be a function');
603
+
604
+ if (!this._events || !this._events[type])
605
+ return this;
606
+
607
+ list = this._events[type];
608
+ length = list.length;
609
+ position = -1;
610
+
611
+ if (list === listener ||
612
+ (isFunction(list.listener) && list.listener === listener)) {
613
+ delete this._events[type];
614
+ if (this._events.removeListener)
615
+ this.emit('removeListener', type, listener);
616
+
617
+ } else if (isObject(list)) {
618
+ for (i = length; i-- > 0;) {
619
+ if (list[i] === listener ||
620
+ (list[i].listener && list[i].listener === listener)) {
621
+ position = i;
622
+ break;
623
+ }
624
+ }
625
+
626
+ if (position < 0)
627
+ return this;
628
+
629
+ if (list.length === 1) {
630
+ list.length = 0;
631
+ delete this._events[type];
632
+ } else {
633
+ list.splice(position, 1);
634
+ }
635
+
636
+ if (this._events.removeListener)
637
+ this.emit('removeListener', type, listener);
638
+ }
639
+
640
+ return this;
641
+ };
642
+
643
+ EventEmitter.prototype.removeAllListeners = function(type) {
644
+ var key, listeners;
645
+
646
+ if (!this._events)
647
+ return this;
648
+
649
+ // not listening for removeListener, no need to emit
650
+ if (!this._events.removeListener) {
651
+ if (arguments.length === 0)
652
+ this._events = {};
653
+ else if (this._events[type])
654
+ delete this._events[type];
655
+ return this;
656
+ }
657
+
658
+ // emit removeListener for all listeners on all events
659
+ if (arguments.length === 0) {
660
+ for (key in this._events) {
661
+ if (key === 'removeListener') continue;
662
+ this.removeAllListeners(key);
663
+ }
664
+ this.removeAllListeners('removeListener');
665
+ this._events = {};
666
+ return this;
667
+ }
668
+
669
+ listeners = this._events[type];
670
+
671
+ if (isFunction(listeners)) {
672
+ this.removeListener(type, listeners);
673
+ } else if (listeners) {
674
+ // LIFO order
675
+ while (listeners.length)
676
+ this.removeListener(type, listeners[listeners.length - 1]);
677
+ }
678
+ delete this._events[type];
679
+
680
+ return this;
681
+ };
682
+
683
+ EventEmitter.prototype.listeners = function(type) {
684
+ var ret;
685
+ if (!this._events || !this._events[type])
686
+ ret = [];
687
+ else if (isFunction(this._events[type]))
688
+ ret = [this._events[type]];
689
+ else
690
+ ret = this._events[type].slice();
691
+ return ret;
692
+ };
693
+
694
+ EventEmitter.prototype.listenerCount = function(type) {
695
+ if (this._events) {
696
+ var evlistener = this._events[type];
697
+
698
+ if (isFunction(evlistener))
699
+ return 1;
700
+ else if (evlistener)
701
+ return evlistener.length;
702
+ }
703
+ return 0;
704
+ };
705
+
706
+ EventEmitter.listenerCount = function(emitter, type) {
707
+ return emitter.listenerCount(type);
708
+ };
709
+
710
+ function isFunction(arg) {
711
+ return typeof arg === 'function';
712
+ }
713
+
714
+ function isNumber(arg) {
715
+ return typeof arg === 'number';
716
+ }
717
+
718
+ function isObject(arg) {
719
+ return typeof arg === 'object' && arg !== null;
720
+ }
721
+
722
+ function isUndefined(arg) {
723
+ return arg === void 0;
724
+ }
725
+
726
+
727
+ /***/ }),
728
+
729
+ /***/ "./node_modules/node-libs-browser/mock/empty.js":
730
+ /*!******************************************************!*\
731
+ !*** ./node_modules/node-libs-browser/mock/empty.js ***!
732
+ \******************************************************/
733
+ /***/ (function() {
734
+
735
+
736
+
737
+ /***/ }),
738
+
739
+ /***/ "./nunjucks/index.js":
740
+ /*!***************************!*\
741
+ !*** ./nunjucks/index.js ***!
742
+ \***************************/
743
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
744
+
745
+ "use strict";
746
+
747
+
748
+ var lib = __webpack_require__(/*! ./src/lib */ "./nunjucks/src/lib.js");
749
+ var _require = __webpack_require__(/*! ./src/environment */ "./nunjucks/src/environment.js"),
750
+ Environment = _require.Environment,
751
+ Template = _require.Template;
752
+ var Loader = __webpack_require__(/*! ./src/loader */ "./nunjucks/src/loader.js");
753
+ var loaders = __webpack_require__(/*! ./src/precompiled-loader */ "./nunjucks/src/precompiled-loader.js");
754
+ var precompile = __webpack_require__(/*! node-libs-browser/mock/empty */ "./node_modules/node-libs-browser/mock/empty.js");
755
+ var compiler = __webpack_require__(/*! node-libs-browser/mock/empty */ "./node_modules/node-libs-browser/mock/empty.js");
756
+ var parser = __webpack_require__(/*! node-libs-browser/mock/empty */ "./node_modules/node-libs-browser/mock/empty.js");
757
+ var lexer = __webpack_require__(/*! node-libs-browser/mock/empty */ "./node_modules/node-libs-browser/mock/empty.js");
758
+ var runtime = __webpack_require__(/*! ./src/runtime */ "./nunjucks/src/runtime.js");
759
+ var nodes = __webpack_require__(/*! node-libs-browser/mock/empty */ "./node_modules/node-libs-browser/mock/empty.js");
760
+ var installJinjaCompat = __webpack_require__(/*! ./src/jinja-compat */ "./nunjucks/src/jinja-compat.js");
761
+
762
+ // A single instance of an environment, since this is so commonly used
763
+ var e;
764
+ function configure(templatesPath, opts) {
765
+ opts = opts || {};
766
+ if (lib.isObject(templatesPath)) {
767
+ opts = templatesPath;
768
+ templatesPath = null;
769
+ }
770
+ var TemplateLoader;
771
+ if (loaders.FileSystemLoader) {
772
+ TemplateLoader = new loaders.FileSystemLoader(templatesPath, {
773
+ watch: opts.watch,
774
+ noCache: opts.noCache
775
+ });
776
+ } else if (loaders.WebLoader) {
777
+ TemplateLoader = new loaders.WebLoader(templatesPath, {
778
+ useCache: opts.web && opts.web.useCache,
779
+ async: opts.web && opts.web.async
780
+ });
781
+ }
782
+ e = new Environment(TemplateLoader, opts);
783
+ if (opts && opts.express) {
784
+ e.express(opts.express);
785
+ }
786
+ return e;
787
+ }
788
+ module.exports = {
789
+ Environment: Environment,
790
+ Template: Template,
791
+ Loader: Loader,
792
+ FileSystemLoader: loaders.FileSystemLoader,
793
+ NodeResolveLoader: loaders.NodeResolveLoader,
794
+ PrecompiledLoader: loaders.PrecompiledLoader,
795
+ WebLoader: loaders.WebLoader,
796
+ compiler: compiler,
797
+ parser: parser,
798
+ lexer: lexer,
799
+ runtime: runtime,
800
+ lib: lib,
801
+ nodes: nodes,
802
+ installJinjaCompat: installJinjaCompat,
803
+ configure: configure,
804
+ reset: function reset() {
805
+ e = undefined;
806
+ },
807
+ compile: function compile(src, env, path, eagerCompile) {
808
+ if (!e) {
809
+ configure();
810
+ }
811
+ return new Template(src, env, path, eagerCompile);
812
+ },
813
+ render: function render(name, ctx, cb) {
814
+ if (!e) {
815
+ configure();
816
+ }
817
+ return e.render(name, ctx, cb);
818
+ },
819
+ renderString: function renderString(src, ctx, cb) {
820
+ if (!e) {
821
+ configure();
822
+ }
823
+ return e.renderString(src, ctx, cb);
824
+ },
825
+ precompile: precompile ? precompile.precompile : undefined,
826
+ precompileString: precompile ? precompile.precompileString : undefined
827
+ };
828
+
829
+ /***/ }),
830
+
831
+ /***/ "./nunjucks/src/environment.js":
832
+ /*!*************************************!*\
833
+ !*** ./nunjucks/src/environment.js ***!
834
+ \*************************************/
835
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
836
+
837
+ "use strict";
838
+
839
+
840
+ function _inheritsLoose(t, o) { t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o); }
841
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
842
+ var asap = __webpack_require__(/*! asap */ "./node_modules/asap/browser-asap.js");
843
+ var _waterfall = __webpack_require__(/*! a-sync-waterfall */ "./node_modules/a-sync-waterfall/index.js");
844
+ var lib = __webpack_require__(/*! ./lib */ "./nunjucks/src/lib.js");
845
+ var compiler = __webpack_require__(/*! node-libs-browser/mock/empty */ "./node_modules/node-libs-browser/mock/empty.js");
846
+ var filters = __webpack_require__(/*! ./filters */ "./nunjucks/src/filters.js");
847
+ var _require = __webpack_require__(/*! ./precompiled-loader */ "./nunjucks/src/precompiled-loader.js"),
848
+ FileSystemLoader = _require.FileSystemLoader,
849
+ WebLoader = _require.WebLoader,
850
+ PrecompiledLoader = _require.PrecompiledLoader;
851
+ var tests = __webpack_require__(/*! ./tests */ "./nunjucks/src/tests.js");
852
+ var globals = __webpack_require__(/*! ./globals */ "./nunjucks/src/globals.js");
853
+ var _require2 = __webpack_require__(/*! ./object */ "./nunjucks/src/object.js"),
854
+ Obj = _require2.Obj,
855
+ EmitterObj = _require2.EmitterObj;
856
+ var globalRuntime = __webpack_require__(/*! ./runtime */ "./nunjucks/src/runtime.js");
857
+ var handleError = globalRuntime.handleError,
858
+ Frame = globalRuntime.Frame;
859
+ var expressApp = __webpack_require__(/*! ./express-app */ "./nunjucks/src/express-app.js");
860
+
861
+ // If the user is using the async API, *always* call it
862
+ // asynchronously even if the template was synchronous.
863
+ function callbackAsap(cb, err, res) {
864
+ asap(function () {
865
+ cb(err, res);
866
+ });
867
+ }
868
+
869
+ /**
870
+ * A no-op template, for use with {% include ignore missing %}
871
+ */
872
+ var noopTmplSrc = {
873
+ type: 'code',
874
+ obj: {
875
+ root: function root(env, context, frame, runtime, cb) {
876
+ try {
877
+ cb(null, '');
878
+ } catch (e) {
879
+ cb(handleError(e, null, null));
880
+ }
881
+ }
882
+ }
883
+ };
884
+ var Environment = /*#__PURE__*/function (_EmitterObj) {
885
+ function Environment() {
886
+ return _EmitterObj.apply(this, arguments) || this;
887
+ }
888
+ _inheritsLoose(Environment, _EmitterObj);
889
+ var _proto = Environment.prototype;
890
+ _proto.init = function init(loaders, opts) {
891
+ var _this = this;
892
+ // The dev flag determines the trace that'll be shown on errors.
893
+ // If set to true, returns the full trace from the error point,
894
+ // otherwise will return trace starting from Template.render
895
+ // (the full trace from within nunjucks may confuse developers using
896
+ // the library)
897
+ // defaults to false
898
+ opts = this.opts = opts || {};
899
+ this.opts.dev = !!opts.dev;
900
+
901
+ // The autoescape flag sets global autoescaping. If true,
902
+ // every string variable will be escaped by default.
903
+ // If false, strings can be manually escaped using the `escape` filter.
904
+ // defaults to true
905
+ this.opts.autoescape = opts.autoescape != null ? opts.autoescape : true;
906
+
907
+ // If true, this will make the system throw errors if trying
908
+ // to output a null or undefined value
909
+ this.opts.throwOnUndefined = !!opts.throwOnUndefined;
910
+ this.opts.trimBlocks = !!opts.trimBlocks;
911
+ this.opts.lstripBlocks = !!opts.lstripBlocks;
912
+ this.loaders = [];
913
+ if (!loaders) {
914
+ // The filesystem loader is only available server-side
915
+ if (FileSystemLoader) {
916
+ this.loaders = [new FileSystemLoader('views')];
917
+ } else if (WebLoader) {
918
+ this.loaders = [new WebLoader('/views')];
919
+ }
920
+ } else {
921
+ this.loaders = lib.isArray(loaders) ? loaders : [loaders];
922
+ }
923
+
924
+ // It's easy to use precompiled templates: just include them
925
+ // before you configure nunjucks and this will automatically
926
+ // pick it up and use it
927
+ if (typeof window !== 'undefined' && window.nunjucksPrecompiled) {
928
+ this.loaders.unshift(new PrecompiledLoader(window.nunjucksPrecompiled));
929
+ }
930
+ this._initLoaders();
931
+ this.globals = globals();
932
+ this.filters = {};
933
+ this.tests = {};
934
+ this.asyncFilters = [];
935
+ this.extensions = {};
936
+ this.extensionsList = [];
937
+ lib._entries(filters).forEach(function (_ref) {
938
+ var name = _ref[0],
939
+ filter = _ref[1];
940
+ return _this.addFilter(name, filter);
941
+ });
942
+ lib._entries(tests).forEach(function (_ref2) {
943
+ var name = _ref2[0],
944
+ test = _ref2[1];
945
+ return _this.addTest(name, test);
946
+ });
947
+ };
948
+ _proto._initLoaders = function _initLoaders() {
949
+ var _this2 = this;
950
+ this.loaders.forEach(function (loader) {
951
+ // Caching and cache busting
952
+ loader.cache = {};
953
+ if (typeof loader.on === 'function') {
954
+ loader.on('update', function (name, fullname) {
955
+ loader.cache[name] = null;
956
+ _this2.emit('update', name, fullname, loader);
957
+ });
958
+ loader.on('load', function (name, source) {
959
+ _this2.emit('load', name, source, loader);
960
+ });
961
+ }
962
+ });
963
+ };
964
+ _proto.invalidateCache = function invalidateCache() {
965
+ this.loaders.forEach(function (loader) {
966
+ loader.cache = {};
967
+ });
968
+ };
969
+ _proto.addExtension = function addExtension(name, extension) {
970
+ extension.__name = name;
971
+ this.extensions[name] = extension;
972
+ this.extensionsList.push(extension);
973
+ return this;
974
+ };
975
+ _proto.removeExtension = function removeExtension(name) {
976
+ var extension = this.getExtension(name);
977
+ if (!extension) {
978
+ return;
979
+ }
980
+ this.extensionsList = lib.without(this.extensionsList, extension);
981
+ delete this.extensions[name];
982
+ };
983
+ _proto.getExtension = function getExtension(name) {
984
+ return this.extensions[name];
985
+ };
986
+ _proto.hasExtension = function hasExtension(name) {
987
+ return !!this.extensions[name];
988
+ };
989
+ _proto.addGlobal = function addGlobal(name, value) {
990
+ this.globals[name] = value;
991
+ return this;
992
+ };
993
+ _proto.getGlobal = function getGlobal(name) {
994
+ if (typeof this.globals[name] === 'undefined') {
995
+ throw new Error('global not found: ' + name);
996
+ }
997
+ return this.globals[name];
998
+ };
999
+ _proto.addFilter = function addFilter(name, func, async) {
1000
+ var wrapped = func;
1001
+ if (async) {
1002
+ this.asyncFilters.push(name);
1003
+ }
1004
+ this.filters[name] = wrapped;
1005
+ return this;
1006
+ };
1007
+ _proto.getFilter = function getFilter(name) {
1008
+ if (!this.filters[name]) {
1009
+ throw new Error('filter not found: ' + name);
1010
+ }
1011
+ return this.filters[name];
1012
+ };
1013
+ _proto.addTest = function addTest(name, func) {
1014
+ this.tests[name] = func;
1015
+ return this;
1016
+ };
1017
+ _proto.getTest = function getTest(name) {
1018
+ if (!this.tests[name]) {
1019
+ throw new Error('test not found: ' + name);
1020
+ }
1021
+ return this.tests[name];
1022
+ };
1023
+ _proto.resolveTemplate = function resolveTemplate(loader, parentName, filename) {
1024
+ var isRelative = loader.isRelative && parentName ? loader.isRelative(filename) : false;
1025
+ return isRelative && loader.resolve ? loader.resolve(parentName, filename) : filename;
1026
+ };
1027
+ _proto.getTemplate = function getTemplate(name, eagerCompile, parentName, ignoreMissing, cb) {
1028
+ var _this3 = this;
1029
+ var that = this;
1030
+ var tmpl = null;
1031
+ if (name && name.raw) {
1032
+ // this fixes autoescape for templates referenced in symbols
1033
+ name = name.raw;
1034
+ }
1035
+ if (lib.isFunction(parentName)) {
1036
+ cb = parentName;
1037
+ parentName = null;
1038
+ eagerCompile = eagerCompile || false;
1039
+ }
1040
+ if (lib.isFunction(eagerCompile)) {
1041
+ cb = eagerCompile;
1042
+ eagerCompile = false;
1043
+ }
1044
+ if (name instanceof Template) {
1045
+ tmpl = name;
1046
+ } else if (typeof name !== 'string') {
1047
+ throw new Error('template names must be a string: ' + name);
1048
+ } else {
1049
+ for (var i = 0; i < this.loaders.length; i++) {
1050
+ var loader = this.loaders[i];
1051
+ tmpl = loader.cache[this.resolveTemplate(loader, parentName, name)];
1052
+ if (tmpl) {
1053
+ break;
1054
+ }
1055
+ }
1056
+ }
1057
+ if (tmpl) {
1058
+ if (eagerCompile) {
1059
+ tmpl.compile();
1060
+ }
1061
+ if (cb) {
1062
+ cb(null, tmpl);
1063
+ return undefined;
1064
+ } else {
1065
+ return tmpl;
1066
+ }
1067
+ }
1068
+ var syncResult;
1069
+ var createTemplate = function createTemplate(err, info) {
1070
+ if (!info && !err && !ignoreMissing) {
1071
+ err = new Error('template not found: ' + name);
1072
+ }
1073
+ if (err) {
1074
+ if (cb) {
1075
+ cb(err);
1076
+ return;
1077
+ } else {
1078
+ throw err;
1079
+ }
1080
+ }
1081
+ var newTmpl;
1082
+ if (!info) {
1083
+ newTmpl = new Template(noopTmplSrc, _this3, '', eagerCompile);
1084
+ } else {
1085
+ newTmpl = new Template(info.src, _this3, info.path, eagerCompile);
1086
+ if (!info.noCache) {
1087
+ info.loader.cache[name] = newTmpl;
1088
+ }
1089
+ }
1090
+ if (cb) {
1091
+ cb(null, newTmpl);
1092
+ } else {
1093
+ syncResult = newTmpl;
1094
+ }
1095
+ };
1096
+ lib.asyncIter(this.loaders, function (loader, i, next, done) {
1097
+ function handle(err, src) {
1098
+ if (err) {
1099
+ done(err);
1100
+ } else if (src) {
1101
+ src.loader = loader;
1102
+ done(null, src);
1103
+ } else {
1104
+ next();
1105
+ }
1106
+ }
1107
+
1108
+ // Resolve name relative to parentName
1109
+ name = that.resolveTemplate(loader, parentName, name);
1110
+ if (loader.async) {
1111
+ loader.getSource(name, handle);
1112
+ } else {
1113
+ handle(null, loader.getSource(name));
1114
+ }
1115
+ }, createTemplate);
1116
+ return syncResult;
1117
+ };
1118
+ _proto.express = function express(app) {
1119
+ return expressApp(this, app);
1120
+ };
1121
+ _proto.render = function render(name, ctx, cb) {
1122
+ if (lib.isFunction(ctx)) {
1123
+ cb = ctx;
1124
+ ctx = null;
1125
+ }
1126
+
1127
+ // We support a synchronous API to make it easier to migrate
1128
+ // existing code to async. This works because if you don't do
1129
+ // anything async work, the whole thing is actually run
1130
+ // synchronously.
1131
+ var syncResult = null;
1132
+ this.getTemplate(name, function (err, tmpl) {
1133
+ if (err && cb) {
1134
+ callbackAsap(cb, err);
1135
+ } else if (err) {
1136
+ throw err;
1137
+ } else {
1138
+ syncResult = tmpl.render(ctx, cb);
1139
+ }
1140
+ });
1141
+ return syncResult;
1142
+ };
1143
+ _proto.renderString = function renderString(src, ctx, opts, cb) {
1144
+ if (lib.isFunction(opts)) {
1145
+ cb = opts;
1146
+ opts = {};
1147
+ }
1148
+ opts = opts || {};
1149
+ var tmpl = new Template(src, this, opts.path);
1150
+ return tmpl.render(ctx, cb);
1151
+ };
1152
+ _proto.waterfall = function waterfall(tasks, callback, forceAsync) {
1153
+ return _waterfall(tasks, callback, forceAsync);
1154
+ };
1155
+ return Environment;
1156
+ }(EmitterObj);
1157
+ var Context = /*#__PURE__*/function (_Obj) {
1158
+ function Context() {
1159
+ return _Obj.apply(this, arguments) || this;
1160
+ }
1161
+ _inheritsLoose(Context, _Obj);
1162
+ var _proto2 = Context.prototype;
1163
+ _proto2.init = function init(ctx, blocks, env) {
1164
+ var _this4 = this;
1165
+ // Has to be tied to an environment so we can tap into its globals.
1166
+ this.env = env || new Environment();
1167
+
1168
+ // Make a duplicate of ctx
1169
+ this.ctx = lib.extend({}, ctx);
1170
+ this.blocks = {};
1171
+ this.exported = [];
1172
+ lib.keys(blocks).forEach(function (name) {
1173
+ _this4.addBlock(name, blocks[name]);
1174
+ });
1175
+ };
1176
+ _proto2.lookup = function lookup(name) {
1177
+ // This is one of the most called functions, so optimize for
1178
+ // the typical case where the name isn't in the globals
1179
+ if (name in this.env.globals && !(name in this.ctx)) {
1180
+ return this.env.globals[name];
1181
+ } else {
1182
+ return this.ctx[name];
1183
+ }
1184
+ };
1185
+ _proto2.setVariable = function setVariable(name, val) {
1186
+ this.ctx[name] = val;
1187
+ };
1188
+ _proto2.getVariables = function getVariables() {
1189
+ return this.ctx;
1190
+ };
1191
+ _proto2.addBlock = function addBlock(name, block) {
1192
+ this.blocks[name] = this.blocks[name] || [];
1193
+ this.blocks[name].push(block);
1194
+ return this;
1195
+ };
1196
+ _proto2.getBlock = function getBlock(name) {
1197
+ if (!this.blocks[name]) {
1198
+ throw new Error('unknown block "' + name + '"');
1199
+ }
1200
+ return this.blocks[name][0];
1201
+ };
1202
+ _proto2.getSuper = function getSuper(env, name, block, frame, runtime, cb) {
1203
+ var idx = lib.indexOf(this.blocks[name] || [], block);
1204
+ var blk = this.blocks[name][idx + 1];
1205
+ var context = this;
1206
+ if (idx === -1 || !blk) {
1207
+ throw new Error('no super block available for "' + name + '"');
1208
+ }
1209
+ blk(env, context, frame, runtime, cb);
1210
+ };
1211
+ _proto2.addExport = function addExport(name) {
1212
+ this.exported.push(name);
1213
+ };
1214
+ _proto2.getExported = function getExported() {
1215
+ var _this5 = this;
1216
+ var exported = {};
1217
+ this.exported.forEach(function (name) {
1218
+ exported[name] = _this5.ctx[name];
1219
+ });
1220
+ return exported;
1221
+ };
1222
+ return Context;
1223
+ }(Obj);
1224
+ var Template = /*#__PURE__*/function (_Obj2) {
1225
+ function Template() {
1226
+ return _Obj2.apply(this, arguments) || this;
1227
+ }
1228
+ _inheritsLoose(Template, _Obj2);
1229
+ var _proto3 = Template.prototype;
1230
+ _proto3.init = function init(src, env, path, eagerCompile) {
1231
+ this.env = env || new Environment();
1232
+ if (lib.isObject(src)) {
1233
+ switch (src.type) {
1234
+ case 'code':
1235
+ this.tmplProps = src.obj;
1236
+ break;
1237
+ case 'string':
1238
+ this.tmplStr = src.obj;
1239
+ break;
1240
+ default:
1241
+ throw new Error("Unexpected template object type " + src.type + "; expected 'code', or 'string'");
1242
+ }
1243
+ } else if (lib.isString(src)) {
1244
+ this.tmplStr = src;
1245
+ } else {
1246
+ throw new Error('src must be a string or an object describing the source');
1247
+ }
1248
+ this.path = path;
1249
+ if (eagerCompile) {
1250
+ try {
1251
+ this._compile();
1252
+ } catch (err) {
1253
+ throw lib._prettifyError(this.path, this.env.opts.dev, err);
1254
+ }
1255
+ } else {
1256
+ this.compiled = false;
1257
+ }
1258
+ };
1259
+ _proto3.render = function render(ctx, parentFrame, cb) {
1260
+ var _this6 = this;
1261
+ if (typeof ctx === 'function') {
1262
+ cb = ctx;
1263
+ ctx = {};
1264
+ } else if (typeof parentFrame === 'function') {
1265
+ cb = parentFrame;
1266
+ parentFrame = null;
1267
+ }
1268
+
1269
+ // If there is a parent frame, we are being called from internal
1270
+ // code of another template, and the internal system
1271
+ // depends on the sync/async nature of the parent template
1272
+ // to be inherited, so force an async callback
1273
+ var forceAsync = !parentFrame;
1274
+
1275
+ // Catch compile errors for async rendering
1276
+ try {
1277
+ this.compile();
1278
+ } catch (e) {
1279
+ var err = lib._prettifyError(this.path, this.env.opts.dev, e);
1280
+ if (cb) {
1281
+ return callbackAsap(cb, err);
1282
+ } else {
1283
+ throw err;
1284
+ }
1285
+ }
1286
+ var context = new Context(ctx || {}, this.blocks, this.env);
1287
+ var frame = parentFrame ? parentFrame.push(true) : new Frame();
1288
+ frame.topLevel = true;
1289
+ var syncResult = null;
1290
+ var didError = false;
1291
+ this.rootRenderFunc(this.env, context, frame, globalRuntime, function (err, res) {
1292
+ // TODO: this is actually a bug in the compiled template (because waterfall
1293
+ // tasks are both not passing errors up the chain of callbacks AND are not
1294
+ // causing a return from the top-most render function). But fixing that
1295
+ // will require a more substantial change to the compiler.
1296
+ if (didError && cb && typeof res !== 'undefined') {
1297
+ // prevent multiple calls to cb
1298
+ return;
1299
+ }
1300
+ if (err) {
1301
+ err = lib._prettifyError(_this6.path, _this6.env.opts.dev, err);
1302
+ didError = true;
1303
+ }
1304
+ if (cb) {
1305
+ if (forceAsync) {
1306
+ callbackAsap(cb, err, res);
1307
+ } else {
1308
+ cb(err, res);
1309
+ }
1310
+ } else {
1311
+ if (err) {
1312
+ throw err;
1313
+ }
1314
+ syncResult = res;
1315
+ }
1316
+ });
1317
+ return syncResult;
1318
+ };
1319
+ _proto3.getExported = function getExported(ctx, parentFrame, cb) {
1320
+ // eslint-disable-line consistent-return
1321
+ if (typeof ctx === 'function') {
1322
+ cb = ctx;
1323
+ ctx = {};
1324
+ }
1325
+ if (typeof parentFrame === 'function') {
1326
+ cb = parentFrame;
1327
+ parentFrame = null;
1328
+ }
1329
+
1330
+ // Catch compile errors for async rendering
1331
+ try {
1332
+ this.compile();
1333
+ } catch (e) {
1334
+ if (cb) {
1335
+ return cb(e);
1336
+ } else {
1337
+ throw e;
1338
+ }
1339
+ }
1340
+ var frame = parentFrame ? parentFrame.push() : new Frame();
1341
+ frame.topLevel = true;
1342
+
1343
+ // Run the rootRenderFunc to populate the context with exported vars
1344
+ var context = new Context(ctx || {}, this.blocks, this.env);
1345
+ this.rootRenderFunc(this.env, context, frame, globalRuntime, function (err) {
1346
+ if (err) {
1347
+ cb(err, null);
1348
+ } else {
1349
+ cb(null, context.getExported());
1350
+ }
1351
+ });
1352
+ };
1353
+ _proto3.compile = function compile() {
1354
+ if (!this.compiled) {
1355
+ this._compile();
1356
+ }
1357
+ };
1358
+ _proto3._compile = function _compile() {
1359
+ var props;
1360
+ if (this.tmplProps) {
1361
+ props = this.tmplProps;
1362
+ } else {
1363
+ var source = compiler.compile(this.tmplStr, this.env.asyncFilters, this.env.extensionsList, this.path, this.env.opts);
1364
+ var func = new Function(source); // eslint-disable-line no-new-func
1365
+ props = func();
1366
+ }
1367
+ this.blocks = this._getBlocks(props);
1368
+ this.rootRenderFunc = props.root;
1369
+ this.compiled = true;
1370
+ };
1371
+ _proto3._getBlocks = function _getBlocks(props) {
1372
+ var blocks = {};
1373
+ lib.keys(props).forEach(function (k) {
1374
+ if (k.slice(0, 2) === 'b_') {
1375
+ blocks[k.slice(2)] = props[k];
1376
+ }
1377
+ });
1378
+ return blocks;
1379
+ };
1380
+ return Template;
1381
+ }(Obj);
1382
+ module.exports = {
1383
+ Environment: Environment,
1384
+ Template: Template
1385
+ };
1386
+
1387
+ /***/ }),
1388
+
1389
+ /***/ "./nunjucks/src/express-app.js":
1390
+ /*!*************************************!*\
1391
+ !*** ./nunjucks/src/express-app.js ***!
1392
+ \*************************************/
1393
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1394
+
1395
+ var path = __webpack_require__(/*! node-libs-browser/mock/empty */ "./node_modules/node-libs-browser/mock/empty.js");
1396
+ module.exports = function express(env, app) {
1397
+ function NunjucksView(name, opts) {
1398
+ this.name = name;
1399
+ this.path = name;
1400
+ this.defaultEngine = opts.defaultEngine;
1401
+ this.ext = path.extname(name);
1402
+ if (!this.ext && !this.defaultEngine) {
1403
+ throw new Error('No default engine was specified and no extension was provided.');
1404
+ }
1405
+ if (!this.ext) {
1406
+ this.name += this.ext = (this.defaultEngine[0] !== '.' ? '.' : '') + this.defaultEngine;
1407
+ }
1408
+ }
1409
+ NunjucksView.prototype.render = function render(opts, cb) {
1410
+ env.render(this.name, opts, cb);
1411
+ };
1412
+ app.set('view', NunjucksView);
1413
+ app.set('nunjucksEnv', env);
1414
+ return env;
1415
+ };
1416
+
1417
+ /***/ }),
1418
+
1419
+ /***/ "./nunjucks/src/filters.js":
1420
+ /*!*********************************!*\
1421
+ !*** ./nunjucks/src/filters.js ***!
1422
+ \*********************************/
1423
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1424
+
1425
+ "use strict";
1426
+
1427
+
1428
+ var lib = __webpack_require__(/*! ./lib */ "./nunjucks/src/lib.js");
1429
+ var r = __webpack_require__(/*! ./runtime */ "./nunjucks/src/runtime.js");
1430
+ var exports = module.exports = {};
1431
+ function normalize(value, defaultValue) {
1432
+ if (value === null || value === undefined || value === false) {
1433
+ return defaultValue;
1434
+ }
1435
+ return value;
1436
+ }
1437
+ exports.abs = Math.abs;
1438
+ function isNaN(num) {
1439
+ return num !== num; // eslint-disable-line no-self-compare
1440
+ }
1441
+ function batch(arr, linecount, fillWith) {
1442
+ var i;
1443
+ var res = [];
1444
+ var tmp = [];
1445
+ for (i = 0; i < arr.length; i++) {
1446
+ if (i % linecount === 0 && tmp.length) {
1447
+ res.push(tmp);
1448
+ tmp = [];
1449
+ }
1450
+ tmp.push(arr[i]);
1451
+ }
1452
+ if (tmp.length) {
1453
+ if (fillWith) {
1454
+ for (i = tmp.length; i < linecount; i++) {
1455
+ tmp.push(fillWith);
1456
+ }
1457
+ }
1458
+ res.push(tmp);
1459
+ }
1460
+ return res;
1461
+ }
1462
+ exports.batch = batch;
1463
+ function capitalize(str) {
1464
+ str = normalize(str, '');
1465
+ var ret = str.toLowerCase();
1466
+ return r.copySafeness(str, ret.charAt(0).toUpperCase() + ret.slice(1));
1467
+ }
1468
+ exports.capitalize = capitalize;
1469
+ function center(str, width) {
1470
+ str = normalize(str, '');
1471
+ width = width || 80;
1472
+ if (str.length >= width) {
1473
+ return str;
1474
+ }
1475
+ var spaces = width - str.length;
1476
+ var pre = lib.repeat(' ', spaces / 2 - spaces % 2);
1477
+ var post = lib.repeat(' ', spaces / 2);
1478
+ return r.copySafeness(str, pre + str + post);
1479
+ }
1480
+ exports.center = center;
1481
+ function default_(val, def, bool) {
1482
+ if (bool) {
1483
+ return val || def;
1484
+ } else {
1485
+ return val !== undefined ? val : def;
1486
+ }
1487
+ }
1488
+
1489
+ // TODO: it is confusing to export something called 'default'
1490
+ exports['default'] = default_; // eslint-disable-line dot-notation
1491
+
1492
+ function dictsort(val, caseSensitive, by) {
1493
+ if (!lib.isObject(val)) {
1494
+ throw new lib.TemplateError('dictsort filter: val must be an object');
1495
+ }
1496
+ var array = [];
1497
+ // deliberately include properties from the object's prototype
1498
+ for (var k in val) {
1499
+ // eslint-disable-line guard-for-in, no-restricted-syntax
1500
+ array.push([k, val[k]]);
1501
+ }
1502
+ var si;
1503
+ if (by === undefined || by === 'key') {
1504
+ si = 0;
1505
+ } else if (by === 'value') {
1506
+ si = 1;
1507
+ } else {
1508
+ throw new lib.TemplateError('dictsort filter: You can only sort by either key or value');
1509
+ }
1510
+ array.sort(function (t1, t2) {
1511
+ var a = t1[si];
1512
+ var b = t2[si];
1513
+ if (!caseSensitive) {
1514
+ if (lib.isString(a)) {
1515
+ a = a.toUpperCase();
1516
+ }
1517
+ if (lib.isString(b)) {
1518
+ b = b.toUpperCase();
1519
+ }
1520
+ }
1521
+ return a > b ? 1 : a === b ? 0 : -1; // eslint-disable-line no-nested-ternary
1522
+ });
1523
+ return array;
1524
+ }
1525
+ exports.dictsort = dictsort;
1526
+ function dump(obj, spaces) {
1527
+ return JSON.stringify(obj, null, spaces);
1528
+ }
1529
+ exports.dump = dump;
1530
+ function escape(str) {
1531
+ if (str instanceof r.SafeString) {
1532
+ return str;
1533
+ }
1534
+ str = str === null || str === undefined ? '' : str;
1535
+ return r.markSafe(lib.escape(str.toString()));
1536
+ }
1537
+ exports.escape = escape;
1538
+ function safe(str) {
1539
+ if (str instanceof r.SafeString) {
1540
+ return str;
1541
+ }
1542
+ str = str === null || str === undefined ? '' : str;
1543
+ return r.markSafe(str.toString());
1544
+ }
1545
+ exports.safe = safe;
1546
+ function first(arr) {
1547
+ return arr[0];
1548
+ }
1549
+ exports.first = first;
1550
+ function forceescape(str) {
1551
+ str = str === null || str === undefined ? '' : str;
1552
+ return r.markSafe(lib.escape(str.toString()));
1553
+ }
1554
+ exports.forceescape = forceescape;
1555
+ function groupby(arr, attr) {
1556
+ return lib.groupBy(arr, attr, this.env.opts.throwOnUndefined);
1557
+ }
1558
+ exports.groupby = groupby;
1559
+ function indent(str, width, indentfirst) {
1560
+ str = normalize(str, '');
1561
+ if (str === '') {
1562
+ return '';
1563
+ }
1564
+ width = width || 4;
1565
+ // let res = '';
1566
+ var lines = str.split('\n');
1567
+ var sp = lib.repeat(' ', width);
1568
+ var res = lines.map(function (l, i) {
1569
+ return i === 0 && !indentfirst ? l : "" + sp + l;
1570
+ }).join('\n');
1571
+ return r.copySafeness(str, res);
1572
+ }
1573
+ exports.indent = indent;
1574
+ function join(arr, del, attr) {
1575
+ del = del || '';
1576
+ if (attr) {
1577
+ arr = lib.map(arr, function (v) {
1578
+ return v[attr];
1579
+ });
1580
+ }
1581
+ return arr.join(del);
1582
+ }
1583
+ exports.join = join;
1584
+ function last(arr) {
1585
+ return arr[arr.length - 1];
1586
+ }
1587
+ exports.last = last;
1588
+ function lengthFilter(val) {
1589
+ var value = normalize(val, '');
1590
+ if (value !== undefined) {
1591
+ if (typeof Map === 'function' && value instanceof Map || typeof Set === 'function' && value instanceof Set) {
1592
+ // ECMAScript 2015 Maps and Sets
1593
+ return value.size;
1594
+ }
1595
+ if (lib.isObject(value) && !(value instanceof r.SafeString)) {
1596
+ // Objects (besides SafeStrings), non-primative Arrays
1597
+ return lib.keys(value).length;
1598
+ }
1599
+ return value.length;
1600
+ }
1601
+ return 0;
1602
+ }
1603
+ exports.length = lengthFilter;
1604
+ function list(val) {
1605
+ if (lib.isString(val)) {
1606
+ return val.split('');
1607
+ } else if (lib.isObject(val)) {
1608
+ return lib._entries(val || {}).map(function (_ref) {
1609
+ var key = _ref[0],
1610
+ value = _ref[1];
1611
+ return {
1612
+ key: key,
1613
+ value: value
1614
+ };
1615
+ });
1616
+ } else if (lib.isArray(val)) {
1617
+ return val;
1618
+ } else {
1619
+ throw new lib.TemplateError('list filter: type not iterable');
1620
+ }
1621
+ }
1622
+ exports.list = list;
1623
+ function lower(str) {
1624
+ str = normalize(str, '');
1625
+ return str.toLowerCase();
1626
+ }
1627
+ exports.lower = lower;
1628
+ function nl2br(str) {
1629
+ if (str === null || str === undefined) {
1630
+ return '';
1631
+ }
1632
+ return r.copySafeness(str, str.replace(/\r\n|\n/g, '<br />\n'));
1633
+ }
1634
+ exports.nl2br = nl2br;
1635
+ function random(arr) {
1636
+ return arr[Math.floor(Math.random() * arr.length)];
1637
+ }
1638
+ exports.random = random;
1639
+
1640
+ /**
1641
+ * Construct select or reject filter
1642
+ *
1643
+ * @param {boolean} expectedTestResult
1644
+ * @returns {function(array, string, *): array}
1645
+ */
1646
+ function getSelectOrReject(expectedTestResult) {
1647
+ function filter(arr, testName, secondArg) {
1648
+ if (testName === void 0) {
1649
+ testName = 'truthy';
1650
+ }
1651
+ var context = this;
1652
+ var test = context.env.getTest(testName);
1653
+ return lib.toArray(arr).filter(function examineTestResult(item) {
1654
+ return test.call(context, item, secondArg) === expectedTestResult;
1655
+ });
1656
+ }
1657
+ return filter;
1658
+ }
1659
+ exports.reject = getSelectOrReject(false);
1660
+ function rejectattr(arr, attr) {
1661
+ return arr.filter(function (item) {
1662
+ return !item[attr];
1663
+ });
1664
+ }
1665
+ exports.rejectattr = rejectattr;
1666
+ exports.select = getSelectOrReject(true);
1667
+ function selectattr(arr, attr) {
1668
+ return arr.filter(function (item) {
1669
+ return !!item[attr];
1670
+ });
1671
+ }
1672
+ exports.selectattr = selectattr;
1673
+ function replace(str, old, new_, maxCount) {
1674
+ var originalStr = str;
1675
+ if (old instanceof RegExp) {
1676
+ return str.replace(old, new_);
1677
+ }
1678
+ if (typeof maxCount === 'undefined') {
1679
+ maxCount = -1;
1680
+ }
1681
+ var res = ''; // Output
1682
+
1683
+ // Cast Numbers in the search term to string
1684
+ if (typeof old === 'number') {
1685
+ old = '' + old;
1686
+ } else if (typeof old !== 'string') {
1687
+ // If it is something other than number or string,
1688
+ // return the original string
1689
+ return str;
1690
+ }
1691
+
1692
+ // Cast numbers in the replacement to string
1693
+ if (typeof str === 'number') {
1694
+ str = '' + str;
1695
+ }
1696
+
1697
+ // If by now, we don't have a string, throw it back
1698
+ if (typeof str !== 'string' && !(str instanceof r.SafeString)) {
1699
+ return str;
1700
+ }
1701
+
1702
+ // ShortCircuits
1703
+ if (old === '') {
1704
+ // Mimic the python behaviour: empty string is replaced
1705
+ // by replacement e.g. "abc"|replace("", ".") -> .a.b.c.
1706
+ res = new_ + str.split('').join(new_) + new_;
1707
+ return r.copySafeness(str, res);
1708
+ }
1709
+ var nextIndex = str.indexOf(old);
1710
+ // if # of replacements to perform is 0, or the string to does
1711
+ // not contain the old value, return the string
1712
+ if (maxCount === 0 || nextIndex === -1) {
1713
+ return str;
1714
+ }
1715
+ var pos = 0;
1716
+ var count = 0; // # of replacements made
1717
+
1718
+ while (nextIndex > -1 && (maxCount === -1 || count < maxCount)) {
1719
+ // Grab the next chunk of src string and add it with the
1720
+ // replacement, to the result
1721
+ res += str.substring(pos, nextIndex) + new_;
1722
+ // Increment our pointer in the src string
1723
+ pos = nextIndex + old.length;
1724
+ count++;
1725
+ // See if there are any more replacements to be made
1726
+ nextIndex = str.indexOf(old, pos);
1727
+ }
1728
+
1729
+ // We've either reached the end, or done the max # of
1730
+ // replacements, tack on any remaining string
1731
+ if (pos < str.length) {
1732
+ res += str.substring(pos);
1733
+ }
1734
+ return r.copySafeness(originalStr, res);
1735
+ }
1736
+ exports.replace = replace;
1737
+ function reverse(val) {
1738
+ var arr;
1739
+ if (lib.isString(val)) {
1740
+ arr = list(val);
1741
+ } else {
1742
+ // Copy it
1743
+ arr = lib.map(val, function (v) {
1744
+ return v;
1745
+ });
1746
+ }
1747
+ arr.reverse();
1748
+ if (lib.isString(val)) {
1749
+ return r.copySafeness(val, arr.join(''));
1750
+ }
1751
+ return arr;
1752
+ }
1753
+ exports.reverse = reverse;
1754
+ function round(val, precision, method) {
1755
+ precision = precision || 0;
1756
+ var factor = Math.pow(10, precision);
1757
+ var rounder;
1758
+ if (method === 'ceil') {
1759
+ rounder = Math.ceil;
1760
+ } else if (method === 'floor') {
1761
+ rounder = Math.floor;
1762
+ } else {
1763
+ rounder = Math.round;
1764
+ }
1765
+ return rounder(val * factor) / factor;
1766
+ }
1767
+ exports.round = round;
1768
+ function slice(arr, slices, fillWith) {
1769
+ var sliceLength = Math.floor(arr.length / slices);
1770
+ var extra = arr.length % slices;
1771
+ var res = [];
1772
+ var offset = 0;
1773
+ for (var i = 0; i < slices; i++) {
1774
+ var start = offset + i * sliceLength;
1775
+ if (i < extra) {
1776
+ offset++;
1777
+ }
1778
+ var end = offset + (i + 1) * sliceLength;
1779
+ var currSlice = arr.slice(start, end);
1780
+ if (fillWith && i >= extra) {
1781
+ currSlice.push(fillWith);
1782
+ }
1783
+ res.push(currSlice);
1784
+ }
1785
+ return res;
1786
+ }
1787
+ exports.slice = slice;
1788
+ function sum(arr, attr, start) {
1789
+ if (start === void 0) {
1790
+ start = 0;
1791
+ }
1792
+ if (attr) {
1793
+ arr = lib.map(arr, function (v) {
1794
+ return v[attr];
1795
+ });
1796
+ }
1797
+ return start + arr.reduce(function (a, b) {
1798
+ return a + b;
1799
+ }, 0);
1800
+ }
1801
+ exports.sum = sum;
1802
+ exports.sort = r.makeMacro(['value', 'reverse', 'case_sensitive', 'attribute'], [], function sortFilter(arr, reversed, caseSens, attr) {
1803
+ var _this = this;
1804
+ // Copy it
1805
+ var array = lib.map(arr, function (v) {
1806
+ return v;
1807
+ });
1808
+ var getAttribute = lib.getAttrGetter(attr);
1809
+ array.sort(function (a, b) {
1810
+ var x = attr ? getAttribute(a) : a;
1811
+ var y = attr ? getAttribute(b) : b;
1812
+ if (_this.env.opts.throwOnUndefined && attr && (x === undefined || y === undefined)) {
1813
+ throw new TypeError("sort: attribute \"" + attr + "\" resolved to undefined");
1814
+ }
1815
+ if (!caseSens && lib.isString(x) && lib.isString(y)) {
1816
+ x = x.toLowerCase();
1817
+ y = y.toLowerCase();
1818
+ }
1819
+ if (x < y) {
1820
+ return reversed ? 1 : -1;
1821
+ } else if (x > y) {
1822
+ return reversed ? -1 : 1;
1823
+ } else {
1824
+ return 0;
1825
+ }
1826
+ });
1827
+ return array;
1828
+ });
1829
+ function string(obj) {
1830
+ return r.copySafeness(obj, obj);
1831
+ }
1832
+ exports.string = string;
1833
+ function striptags(input, preserveLinebreaks) {
1834
+ input = normalize(input, '');
1835
+ var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>|<!--[\s\S]*?-->/gi;
1836
+ var trimmedInput = trim(input.replace(tags, ''));
1837
+ var res = '';
1838
+ if (preserveLinebreaks) {
1839
+ res = trimmedInput.replace(/^ +| +$/gm, '') // remove leading and trailing spaces
1840
+ .replace(/ +/g, ' ') // squash adjacent spaces
1841
+ .replace(/(\r\n)/g, '\n') // normalize linebreaks (CRLF -> LF)
1842
+ .replace(/\n\n\n+/g, '\n\n'); // squash abnormal adjacent linebreaks
1843
+ } else {
1844
+ res = trimmedInput.replace(/\s+/gi, ' ');
1845
+ }
1846
+ return r.copySafeness(input, res);
1847
+ }
1848
+ exports.striptags = striptags;
1849
+ function title(str) {
1850
+ str = normalize(str, '');
1851
+ var words = str.split(' ').map(function (word) {
1852
+ return capitalize(word);
1853
+ });
1854
+ return r.copySafeness(str, words.join(' '));
1855
+ }
1856
+ exports.title = title;
1857
+ function trim(str) {
1858
+ return r.copySafeness(str, str.replace(/^\s*|\s*$/g, ''));
1859
+ }
1860
+ exports.trim = trim;
1861
+ function truncate(input, length, killwords, end) {
1862
+ var orig = input;
1863
+ input = normalize(input, '');
1864
+ length = length || 255;
1865
+ if (input.length <= length) {
1866
+ return input;
1867
+ }
1868
+ if (killwords) {
1869
+ input = input.substring(0, length);
1870
+ } else {
1871
+ var idx = input.lastIndexOf(' ', length);
1872
+ if (idx === -1) {
1873
+ idx = length;
1874
+ }
1875
+ input = input.substring(0, idx);
1876
+ }
1877
+ input += end !== undefined && end !== null ? end : '...';
1878
+ return r.copySafeness(orig, input);
1879
+ }
1880
+ exports.truncate = truncate;
1881
+ function upper(str) {
1882
+ str = normalize(str, '');
1883
+ return str.toUpperCase();
1884
+ }
1885
+ exports.upper = upper;
1886
+ function urlencode(obj) {
1887
+ var enc = encodeURIComponent;
1888
+ if (lib.isString(obj)) {
1889
+ return enc(obj);
1890
+ } else {
1891
+ var keyvals = lib.isArray(obj) ? obj : lib._entries(obj);
1892
+ return keyvals.map(function (_ref2) {
1893
+ var k = _ref2[0],
1894
+ v = _ref2[1];
1895
+ return enc(k) + "=" + enc(v);
1896
+ }).join('&');
1897
+ }
1898
+ }
1899
+ exports.urlencode = urlencode;
1900
+
1901
+ // For the jinja regexp, see
1902
+ // https://github.com/mitsuhiko/jinja2/blob/f15b814dcba6aa12bc74d1f7d0c881d55f7126be/jinja2/utils.py#L20-L23
1903
+ var puncRe = /^(?:\(|<|&lt;)?(.*?)(?:\.|,|\)|\n|&gt;)?$/;
1904
+ // from http://blog.gerv.net/2011/05/html5_email_address_regexp/
1905
+ var emailRe = /^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i;
1906
+ var httpHttpsRe = /^https?:\/\/.*$/;
1907
+ var wwwRe = /^www\./;
1908
+ var tldRe = /\.(?:org|net|com)(?:\:|\/|$)/;
1909
+ function urlize(str, length, nofollow) {
1910
+ if (isNaN(length)) {
1911
+ length = Infinity;
1912
+ }
1913
+ var noFollowAttr = nofollow === true ? ' rel="nofollow"' : '';
1914
+ var words = str.split(/(\s+)/).filter(function (word) {
1915
+ // If the word has no length, bail. This can happen for str with
1916
+ // trailing whitespace.
1917
+ return word && word.length;
1918
+ }).map(function (word) {
1919
+ var matches = word.match(puncRe);
1920
+ var possibleUrl = matches ? matches[1] : word;
1921
+ var shortUrl = possibleUrl.substr(0, length);
1922
+
1923
+ // url that starts with http or https
1924
+ if (httpHttpsRe.test(possibleUrl)) {
1925
+ return "<a href=\"" + possibleUrl + "\"" + noFollowAttr + ">" + shortUrl + "</a>";
1926
+ }
1927
+
1928
+ // url that starts with www.
1929
+ if (wwwRe.test(possibleUrl)) {
1930
+ return "<a href=\"http://" + possibleUrl + "\"" + noFollowAttr + ">" + shortUrl + "</a>";
1931
+ }
1932
+
1933
+ // an email address of the form username@domain.tld
1934
+ if (emailRe.test(possibleUrl)) {
1935
+ return "<a href=\"mailto:" + possibleUrl + "\">" + possibleUrl + "</a>";
1936
+ }
1937
+
1938
+ // url that ends in .com, .org or .net that is not an email address
1939
+ if (tldRe.test(possibleUrl)) {
1940
+ return "<a href=\"http://" + possibleUrl + "\"" + noFollowAttr + ">" + shortUrl + "</a>";
1941
+ }
1942
+ return word;
1943
+ });
1944
+ return words.join('');
1945
+ }
1946
+ exports.urlize = urlize;
1947
+ function wordcount(str) {
1948
+ str = normalize(str, '');
1949
+ var words = str ? str.match(/\w+/g) : null;
1950
+ return words ? words.length : null;
1951
+ }
1952
+ exports.wordcount = wordcount;
1953
+ function float(val, def) {
1954
+ var res = parseFloat(val);
1955
+ return isNaN(res) ? def : res;
1956
+ }
1957
+ exports.float = float;
1958
+ var intFilter = r.makeMacro(['value', 'default', 'base'], [], function doInt(value, defaultValue, base) {
1959
+ if (base === void 0) {
1960
+ base = 10;
1961
+ }
1962
+ var res = parseInt(value, base);
1963
+ return isNaN(res) ? defaultValue : res;
1964
+ });
1965
+ exports.int = intFilter;
1966
+
1967
+ // Aliases
1968
+ exports.d = exports.default;
1969
+ exports.e = exports.escape;
1970
+
1971
+ /***/ }),
1972
+
1973
+ /***/ "./nunjucks/src/globals.js":
1974
+ /*!*********************************!*\
1975
+ !*** ./nunjucks/src/globals.js ***!
1976
+ \*********************************/
1977
+ /***/ (function(module) {
1978
+
1979
+ "use strict";
1980
+
1981
+
1982
+ function _cycler(items) {
1983
+ var index = -1;
1984
+ return {
1985
+ current: null,
1986
+ reset: function reset() {
1987
+ index = -1;
1988
+ this.current = null;
1989
+ },
1990
+ next: function next() {
1991
+ index++;
1992
+ if (index >= items.length) {
1993
+ index = 0;
1994
+ }
1995
+ this.current = items[index];
1996
+ return this.current;
1997
+ }
1998
+ };
1999
+ }
2000
+ function _joiner(sep) {
2001
+ sep = sep || ',';
2002
+ var first = true;
2003
+ return function () {
2004
+ var val = first ? '' : sep;
2005
+ first = false;
2006
+ return val;
2007
+ };
2008
+ }
2009
+
2010
+ // Making this a function instead so it returns a new object
2011
+ // each time it's called. That way, if something like an environment
2012
+ // uses it, they will each have their own copy.
2013
+ function globals() {
2014
+ return {
2015
+ range: function range(start, stop, step) {
2016
+ if (typeof stop === 'undefined') {
2017
+ stop = start;
2018
+ start = 0;
2019
+ step = 1;
2020
+ } else if (!step) {
2021
+ step = 1;
2022
+ }
2023
+ var arr = [];
2024
+ if (step > 0) {
2025
+ for (var i = start; i < stop; i += step) {
2026
+ arr.push(i);
2027
+ }
2028
+ } else {
2029
+ for (var _i = start; _i > stop; _i += step) {
2030
+ // eslint-disable-line for-direction
2031
+ arr.push(_i);
2032
+ }
2033
+ }
2034
+ return arr;
2035
+ },
2036
+ cycler: function cycler() {
2037
+ return _cycler(Array.prototype.slice.call(arguments));
2038
+ },
2039
+ joiner: function joiner(sep) {
2040
+ return _joiner(sep);
2041
+ }
2042
+ };
2043
+ }
2044
+ module.exports = globals;
2045
+
2046
+ /***/ }),
2047
+
2048
+ /***/ "./nunjucks/src/jinja-compat.js":
2049
+ /*!**************************************!*\
2050
+ !*** ./nunjucks/src/jinja-compat.js ***!
2051
+ \**************************************/
2052
+ /***/ (function(module) {
2053
+
2054
+ function installCompat() {
2055
+ 'use strict';
2056
+
2057
+ /* eslint-disable camelcase */
2058
+
2059
+ // This must be called like `nunjucks.installCompat` so that `this`
2060
+ // references the nunjucks instance
2061
+ var runtime = this.runtime;
2062
+ var lib = this.lib;
2063
+ // Handle slim case where these 'modules' are excluded from the built source
2064
+ var Compiler = this.compiler.Compiler;
2065
+ var Parser = this.parser.Parser;
2066
+ var nodes = this.nodes;
2067
+ var lexer = this.lexer;
2068
+ var orig_contextOrFrameLookup = runtime.contextOrFrameLookup;
2069
+ var orig_memberLookup = runtime.memberLookup;
2070
+ var orig_Compiler_assertType;
2071
+ var orig_Parser_parseAggregate;
2072
+ if (Compiler) {
2073
+ orig_Compiler_assertType = Compiler.prototype.assertType;
2074
+ }
2075
+ if (Parser) {
2076
+ orig_Parser_parseAggregate = Parser.prototype.parseAggregate;
2077
+ }
2078
+ function uninstall() {
2079
+ runtime.contextOrFrameLookup = orig_contextOrFrameLookup;
2080
+ runtime.memberLookup = orig_memberLookup;
2081
+ if (Compiler) {
2082
+ Compiler.prototype.assertType = orig_Compiler_assertType;
2083
+ }
2084
+ if (Parser) {
2085
+ Parser.prototype.parseAggregate = orig_Parser_parseAggregate;
2086
+ }
2087
+ }
2088
+ runtime.contextOrFrameLookup = function contextOrFrameLookup(context, frame, key) {
2089
+ var val = orig_contextOrFrameLookup.apply(this, arguments);
2090
+ if (val !== undefined) {
2091
+ return val;
2092
+ }
2093
+ switch (key) {
2094
+ case 'True':
2095
+ return true;
2096
+ case 'False':
2097
+ return false;
2098
+ case 'None':
2099
+ return null;
2100
+ default:
2101
+ return undefined;
2102
+ }
2103
+ };
2104
+ function getTokensState(tokens) {
2105
+ return {
2106
+ index: tokens.index,
2107
+ lineno: tokens.lineno,
2108
+ colno: tokens.colno
2109
+ };
2110
+ }
2111
+ if (false) // removed by dead control flow
2112
+ { var Slice; }
2113
+ function sliceLookup(obj, start, stop, step) {
2114
+ obj = obj || [];
2115
+ if (start === null) {
2116
+ start = step < 0 ? obj.length - 1 : 0;
2117
+ }
2118
+ if (stop === null) {
2119
+ stop = step < 0 ? -1 : obj.length;
2120
+ } else if (stop < 0) {
2121
+ stop += obj.length;
2122
+ }
2123
+ if (start < 0) {
2124
+ start += obj.length;
2125
+ }
2126
+ var results = [];
2127
+ for (var i = start;; i += step) {
2128
+ if (i < 0 || i > obj.length) {
2129
+ break;
2130
+ }
2131
+ if (step > 0 && i >= stop) {
2132
+ break;
2133
+ }
2134
+ if (step < 0 && i <= stop) {
2135
+ break;
2136
+ }
2137
+ results.push(runtime.memberLookup(obj, i));
2138
+ }
2139
+ return results;
2140
+ }
2141
+ function hasOwnProp(obj, key) {
2142
+ return Object.prototype.hasOwnProperty.call(obj, key);
2143
+ }
2144
+ var ARRAY_MEMBERS = {
2145
+ pop: function pop(index) {
2146
+ if (index === undefined) {
2147
+ return this.pop();
2148
+ }
2149
+ if (index >= this.length || index < 0) {
2150
+ throw new Error('KeyError');
2151
+ }
2152
+ return this.splice(index, 1);
2153
+ },
2154
+ append: function append(element) {
2155
+ return this.push(element);
2156
+ },
2157
+ remove: function remove(element) {
2158
+ for (var i = 0; i < this.length; i++) {
2159
+ if (this[i] === element) {
2160
+ return this.splice(i, 1);
2161
+ }
2162
+ }
2163
+ throw new Error('ValueError');
2164
+ },
2165
+ count: function count(element) {
2166
+ var count = 0;
2167
+ for (var i = 0; i < this.length; i++) {
2168
+ if (this[i] === element) {
2169
+ count++;
2170
+ }
2171
+ }
2172
+ return count;
2173
+ },
2174
+ index: function index(element) {
2175
+ var i;
2176
+ if ((i = this.indexOf(element)) === -1) {
2177
+ throw new Error('ValueError');
2178
+ }
2179
+ return i;
2180
+ },
2181
+ find: function find(element) {
2182
+ return this.indexOf(element);
2183
+ },
2184
+ insert: function insert(index, elem) {
2185
+ return this.splice(index, 0, elem);
2186
+ }
2187
+ };
2188
+ var OBJECT_MEMBERS = {
2189
+ items: function items() {
2190
+ return lib._entries(this);
2191
+ },
2192
+ values: function values() {
2193
+ return lib._values(this);
2194
+ },
2195
+ keys: function keys() {
2196
+ return lib.keys(this);
2197
+ },
2198
+ get: function get(key, def) {
2199
+ var output = this[key];
2200
+ if (output === undefined) {
2201
+ output = def;
2202
+ }
2203
+ return output;
2204
+ },
2205
+ has_key: function has_key(key) {
2206
+ return hasOwnProp(this, key);
2207
+ },
2208
+ pop: function pop(key, def) {
2209
+ var output = this[key];
2210
+ if (output === undefined && def !== undefined) {
2211
+ output = def;
2212
+ } else if (output === undefined) {
2213
+ throw new Error('KeyError');
2214
+ } else {
2215
+ delete this[key];
2216
+ }
2217
+ return output;
2218
+ },
2219
+ popitem: function popitem() {
2220
+ var keys = lib.keys(this);
2221
+ if (!keys.length) {
2222
+ throw new Error('KeyError');
2223
+ }
2224
+ var k = keys[0];
2225
+ var val = this[k];
2226
+ delete this[k];
2227
+ return [k, val];
2228
+ },
2229
+ setdefault: function setdefault(key, def) {
2230
+ if (def === void 0) {
2231
+ def = null;
2232
+ }
2233
+ if (!(key in this)) {
2234
+ this[key] = def;
2235
+ }
2236
+ return this[key];
2237
+ },
2238
+ update: function update(kwargs) {
2239
+ lib._assign(this, kwargs);
2240
+ return null; // Always returns None
2241
+ }
2242
+ };
2243
+ OBJECT_MEMBERS.iteritems = OBJECT_MEMBERS.items;
2244
+ OBJECT_MEMBERS.itervalues = OBJECT_MEMBERS.values;
2245
+ OBJECT_MEMBERS.iterkeys = OBJECT_MEMBERS.keys;
2246
+ runtime.memberLookup = function memberLookup(obj, val, autoescape) {
2247
+ if (arguments.length === 4) {
2248
+ return sliceLookup.apply(this, arguments);
2249
+ }
2250
+ obj = obj || {};
2251
+
2252
+ // If the object is an object, return any of the methods that Python would
2253
+ // otherwise provide.
2254
+ if (lib.isArray(obj) && hasOwnProp(ARRAY_MEMBERS, val)) {
2255
+ return ARRAY_MEMBERS[val].bind(obj);
2256
+ }
2257
+ if (lib.isObject(obj) && hasOwnProp(OBJECT_MEMBERS, val)) {
2258
+ return OBJECT_MEMBERS[val].bind(obj);
2259
+ }
2260
+ return orig_memberLookup.apply(this, arguments);
2261
+ };
2262
+ return uninstall;
2263
+ }
2264
+ module.exports = installCompat;
2265
+
2266
+ /***/ }),
2267
+
2268
+ /***/ "./nunjucks/src/lib.js":
2269
+ /*!*****************************!*\
2270
+ !*** ./nunjucks/src/lib.js ***!
2271
+ \*****************************/
2272
+ /***/ (function(module) {
2273
+
2274
+ "use strict";
2275
+
2276
+
2277
+ var ArrayProto = Array.prototype;
2278
+ var ObjProto = Object.prototype;
2279
+ var escapeMap = {
2280
+ '&': '&amp;',
2281
+ '"': '&quot;',
2282
+ '\'': '&#39;',
2283
+ '<': '&lt;',
2284
+ '>': '&gt;',
2285
+ '\\': '&#92;'
2286
+ };
2287
+ var escapeRegex = /[&"'<>\\]/g;
2288
+ var exports = module.exports = {};
2289
+ function hasOwnProp(obj, k) {
2290
+ return ObjProto.hasOwnProperty.call(obj, k);
2291
+ }
2292
+ exports.hasOwnProp = hasOwnProp;
2293
+ function lookupEscape(ch) {
2294
+ return escapeMap[ch];
2295
+ }
2296
+ function _prettifyError(path, withInternals, err) {
2297
+ if (!err.Update) {
2298
+ // not one of ours, cast it
2299
+ err = new exports.TemplateError(err);
2300
+ }
2301
+ err.Update(path);
2302
+
2303
+ // Unless they marked the dev flag, show them a trace from here
2304
+ if (!withInternals) {
2305
+ var old = err;
2306
+ err = new Error(old.message);
2307
+ err.name = old.name;
2308
+ }
2309
+ return err;
2310
+ }
2311
+ exports._prettifyError = _prettifyError;
2312
+ function TemplateError(message, lineno, colno) {
2313
+ var err;
2314
+ var cause;
2315
+ if (message instanceof Error) {
2316
+ cause = message;
2317
+ message = cause.name + ": " + cause.message;
2318
+ }
2319
+ if (Object.setPrototypeOf) {
2320
+ err = new Error(message);
2321
+ Object.setPrototypeOf(err, TemplateError.prototype);
2322
+ } else {
2323
+ err = this;
2324
+ Object.defineProperty(err, 'message', {
2325
+ enumerable: false,
2326
+ writable: true,
2327
+ value: message
2328
+ });
2329
+ }
2330
+ Object.defineProperty(err, 'name', {
2331
+ value: 'Template render error'
2332
+ });
2333
+ if (Error.captureStackTrace) {
2334
+ Error.captureStackTrace(err, this.constructor);
2335
+ }
2336
+ var getStack;
2337
+ if (cause) {
2338
+ var stackDescriptor = Object.getOwnPropertyDescriptor(cause, 'stack');
2339
+ getStack = stackDescriptor && (stackDescriptor.get || function () {
2340
+ return stackDescriptor.value;
2341
+ });
2342
+ if (!getStack) {
2343
+ getStack = function getStack() {
2344
+ return cause.stack;
2345
+ };
2346
+ }
2347
+ } else {
2348
+ var stack = new Error(message).stack;
2349
+ getStack = function getStack() {
2350
+ return stack;
2351
+ };
2352
+ }
2353
+ Object.defineProperty(err, 'stack', {
2354
+ get: function get() {
2355
+ return getStack.call(err);
2356
+ }
2357
+ });
2358
+ Object.defineProperty(err, 'cause', {
2359
+ value: cause
2360
+ });
2361
+ err.lineno = lineno;
2362
+ err.colno = colno;
2363
+ err.firstUpdate = true;
2364
+ err.Update = function Update(path) {
2365
+ var msg = '(' + (path || 'unknown path') + ')';
2366
+
2367
+ // only show lineno + colno next to path of template
2368
+ // where error occurred
2369
+ if (this.firstUpdate) {
2370
+ if (this.lineno && this.colno) {
2371
+ msg += " [Line " + this.lineno + ", Column " + this.colno + "]";
2372
+ } else if (this.lineno) {
2373
+ msg += " [Line " + this.lineno + "]";
2374
+ }
2375
+ }
2376
+ msg += '\n ';
2377
+ if (this.firstUpdate) {
2378
+ msg += ' ';
2379
+ }
2380
+ this.message = msg + (this.message || '');
2381
+ this.firstUpdate = false;
2382
+ return this;
2383
+ };
2384
+ return err;
2385
+ }
2386
+ if (Object.setPrototypeOf) {
2387
+ Object.setPrototypeOf(TemplateError.prototype, Error.prototype);
2388
+ } else {
2389
+ TemplateError.prototype = Object.create(Error.prototype, {
2390
+ constructor: {
2391
+ value: TemplateError
2392
+ }
2393
+ });
2394
+ }
2395
+ exports.TemplateError = TemplateError;
2396
+ function escape(val) {
2397
+ return val.replace(escapeRegex, lookupEscape);
2398
+ }
2399
+ exports.escape = escape;
2400
+ function isFunction(obj) {
2401
+ return ObjProto.toString.call(obj) === '[object Function]';
2402
+ }
2403
+ exports.isFunction = isFunction;
2404
+ function isArray(obj) {
2405
+ return ObjProto.toString.call(obj) === '[object Array]';
2406
+ }
2407
+ exports.isArray = isArray;
2408
+ function isString(obj) {
2409
+ return ObjProto.toString.call(obj) === '[object String]';
2410
+ }
2411
+ exports.isString = isString;
2412
+ function isObject(obj) {
2413
+ return ObjProto.toString.call(obj) === '[object Object]';
2414
+ }
2415
+ exports.isObject = isObject;
2416
+
2417
+ /**
2418
+ * @param {string|number} attr
2419
+ * @returns {(string|number)[]}
2420
+ * @private
2421
+ */
2422
+ function _prepareAttributeParts(attr) {
2423
+ if (!attr) {
2424
+ return [];
2425
+ }
2426
+ if (typeof attr === 'string') {
2427
+ return attr.split('.');
2428
+ }
2429
+ return [attr];
2430
+ }
2431
+
2432
+ /**
2433
+ * @param {string} attribute Attribute value. Dots allowed.
2434
+ * @returns {function(Object): *}
2435
+ */
2436
+ function getAttrGetter(attribute) {
2437
+ var parts = _prepareAttributeParts(attribute);
2438
+ return function attrGetter(item) {
2439
+ var _item = item;
2440
+ for (var i = 0; i < parts.length; i++) {
2441
+ var part = parts[i];
2442
+
2443
+ // If item is not an object, and we still got parts to handle, it means
2444
+ // that something goes wrong. Just roll out to undefined in that case.
2445
+ if (hasOwnProp(_item, part)) {
2446
+ _item = _item[part];
2447
+ } else {
2448
+ return undefined;
2449
+ }
2450
+ }
2451
+ return _item;
2452
+ };
2453
+ }
2454
+ exports.getAttrGetter = getAttrGetter;
2455
+ function groupBy(obj, val, throwOnUndefined) {
2456
+ var result = {};
2457
+ var iterator = isFunction(val) ? val : getAttrGetter(val);
2458
+ for (var i = 0; i < obj.length; i++) {
2459
+ var value = obj[i];
2460
+ var key = iterator(value, i);
2461
+ if (key === undefined && throwOnUndefined === true) {
2462
+ throw new TypeError("groupby: attribute \"" + val + "\" resolved to undefined");
2463
+ }
2464
+ (result[key] || (result[key] = [])).push(value);
2465
+ }
2466
+ return result;
2467
+ }
2468
+ exports.groupBy = groupBy;
2469
+ function toArray(obj) {
2470
+ return Array.prototype.slice.call(obj);
2471
+ }
2472
+ exports.toArray = toArray;
2473
+ function without(array) {
2474
+ var result = [];
2475
+ if (!array) {
2476
+ return result;
2477
+ }
2478
+ var length = array.length;
2479
+ var contains = toArray(arguments).slice(1);
2480
+ var index = -1;
2481
+ while (++index < length) {
2482
+ if (indexOf(contains, array[index]) === -1) {
2483
+ result.push(array[index]);
2484
+ }
2485
+ }
2486
+ return result;
2487
+ }
2488
+ exports.without = without;
2489
+ function repeat(char_, n) {
2490
+ var str = '';
2491
+ for (var i = 0; i < n; i++) {
2492
+ str += char_;
2493
+ }
2494
+ return str;
2495
+ }
2496
+ exports.repeat = repeat;
2497
+ function each(obj, func, context) {
2498
+ if (obj == null) {
2499
+ return;
2500
+ }
2501
+ if (ArrayProto.forEach && obj.forEach === ArrayProto.forEach) {
2502
+ obj.forEach(func, context);
2503
+ } else if (obj.length === +obj.length) {
2504
+ for (var i = 0, l = obj.length; i < l; i++) {
2505
+ func.call(context, obj[i], i, obj);
2506
+ }
2507
+ }
2508
+ }
2509
+ exports.each = each;
2510
+ function map(obj, func) {
2511
+ var results = [];
2512
+ if (obj == null) {
2513
+ return results;
2514
+ }
2515
+ if (ArrayProto.map && obj.map === ArrayProto.map) {
2516
+ return obj.map(func);
2517
+ }
2518
+ for (var i = 0; i < obj.length; i++) {
2519
+ results[results.length] = func(obj[i], i);
2520
+ }
2521
+ if (obj.length === +obj.length) {
2522
+ results.length = obj.length;
2523
+ }
2524
+ return results;
2525
+ }
2526
+ exports.map = map;
2527
+ function asyncIter(arr, iter, cb) {
2528
+ var i = -1;
2529
+ function next() {
2530
+ i++;
2531
+ if (i < arr.length) {
2532
+ iter(arr[i], i, next, cb);
2533
+ } else {
2534
+ cb();
2535
+ }
2536
+ }
2537
+ next();
2538
+ }
2539
+ exports.asyncIter = asyncIter;
2540
+ function asyncFor(obj, iter, cb) {
2541
+ var keys = keys_(obj || {});
2542
+ var len = keys.length;
2543
+ var i = -1;
2544
+ function next() {
2545
+ i++;
2546
+ var k = keys[i];
2547
+ if (i < len) {
2548
+ iter(k, obj[k], i, len, next);
2549
+ } else {
2550
+ cb();
2551
+ }
2552
+ }
2553
+ next();
2554
+ }
2555
+ exports.asyncFor = asyncFor;
2556
+ function indexOf(arr, searchElement, fromIndex) {
2557
+ return Array.prototype.indexOf.call(arr || [], searchElement, fromIndex);
2558
+ }
2559
+ exports.indexOf = indexOf;
2560
+ function keys_(obj) {
2561
+ /* eslint-disable no-restricted-syntax */
2562
+ var arr = [];
2563
+ for (var k in obj) {
2564
+ if (hasOwnProp(obj, k)) {
2565
+ arr.push(k);
2566
+ }
2567
+ }
2568
+ return arr;
2569
+ }
2570
+ exports.keys = keys_;
2571
+ function _entries(obj) {
2572
+ return keys_(obj).map(function (k) {
2573
+ return [k, obj[k]];
2574
+ });
2575
+ }
2576
+ exports._entries = _entries;
2577
+ function _values(obj) {
2578
+ return keys_(obj).map(function (k) {
2579
+ return obj[k];
2580
+ });
2581
+ }
2582
+ exports._values = _values;
2583
+ function extend(obj1, obj2) {
2584
+ obj1 = obj1 || {};
2585
+ keys_(obj2).forEach(function (k) {
2586
+ obj1[k] = obj2[k];
2587
+ });
2588
+ return obj1;
2589
+ }
2590
+ exports._assign = exports.extend = extend;
2591
+ function inOperator(key, val) {
2592
+ if (isArray(val) || isString(val)) {
2593
+ return val.indexOf(key) !== -1;
2594
+ } else if (isObject(val)) {
2595
+ return key in val;
2596
+ }
2597
+ throw new Error('Cannot use "in" operator to search for "' + key + '" in unexpected types.');
2598
+ }
2599
+ exports.inOperator = inOperator;
2600
+
2601
+ /***/ }),
2602
+
2603
+ /***/ "./nunjucks/src/loader.js":
2604
+ /*!********************************!*\
2605
+ !*** ./nunjucks/src/loader.js ***!
2606
+ \********************************/
2607
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2608
+
2609
+ "use strict";
2610
+
2611
+
2612
+ function _inheritsLoose(t, o) { t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o); }
2613
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
2614
+ var path = __webpack_require__(/*! node-libs-browser/mock/empty */ "./node_modules/node-libs-browser/mock/empty.js");
2615
+ var _require = __webpack_require__(/*! ./object */ "./nunjucks/src/object.js"),
2616
+ EmitterObj = _require.EmitterObj;
2617
+ module.exports = /*#__PURE__*/function (_EmitterObj) {
2618
+ function Loader() {
2619
+ return _EmitterObj.apply(this, arguments) || this;
2620
+ }
2621
+ _inheritsLoose(Loader, _EmitterObj);
2622
+ var _proto = Loader.prototype;
2623
+ _proto.resolve = function resolve(from, to) {
2624
+ return path.resolve(path.dirname(from), to);
2625
+ };
2626
+ _proto.isRelative = function isRelative(filename) {
2627
+ return filename.indexOf('./') === 0 || filename.indexOf('../') === 0;
2628
+ };
2629
+ return Loader;
2630
+ }(EmitterObj);
2631
+
2632
+ /***/ }),
2633
+
2634
+ /***/ "./nunjucks/src/object.js":
2635
+ /*!********************************!*\
2636
+ !*** ./nunjucks/src/object.js ***!
2637
+ \********************************/
2638
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2639
+
2640
+ "use strict";
2641
+
2642
+
2643
+ // A simple class system, more documentation to come
2644
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
2645
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
2646
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
2647
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
2648
+ function _inheritsLoose(t, o) { t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o); }
2649
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
2650
+ var EventEmitter = __webpack_require__(/*! events */ "./node_modules/events/events.js");
2651
+ var lib = __webpack_require__(/*! ./lib */ "./nunjucks/src/lib.js");
2652
+ function parentWrap(parent, prop) {
2653
+ if (typeof parent !== 'function' || typeof prop !== 'function') {
2654
+ return prop;
2655
+ }
2656
+ return function wrap() {
2657
+ // Save the current parent method
2658
+ var tmp = this.parent;
2659
+
2660
+ // Set parent to the previous method, call, and restore
2661
+ this.parent = parent;
2662
+ var res = prop.apply(this, arguments);
2663
+ this.parent = tmp;
2664
+ return res;
2665
+ };
2666
+ }
2667
+ function extendClass(cls, name, props) {
2668
+ props = props || {};
2669
+ lib.keys(props).forEach(function (k) {
2670
+ props[k] = parentWrap(cls.prototype[k], props[k]);
2671
+ });
2672
+ var subclass = /*#__PURE__*/function (_cls) {
2673
+ function subclass() {
2674
+ return _cls.apply(this, arguments) || this;
2675
+ }
2676
+ _inheritsLoose(subclass, _cls);
2677
+ return _createClass(subclass, [{
2678
+ key: "typename",
2679
+ get: function get() {
2680
+ return name;
2681
+ }
2682
+ }]);
2683
+ }(cls);
2684
+ lib._assign(subclass.prototype, props);
2685
+ return subclass;
2686
+ }
2687
+ var Obj = /*#__PURE__*/function () {
2688
+ function Obj() {
2689
+ // Unfortunately necessary for backwards compatibility
2690
+ this.init.apply(this, arguments);
2691
+ }
2692
+ var _proto = Obj.prototype;
2693
+ _proto.init = function init() {};
2694
+ Obj.extend = function extend(name, props) {
2695
+ if (typeof name === 'object') {
2696
+ props = name;
2697
+ name = 'anonymous';
2698
+ }
2699
+ return extendClass(this, name, props);
2700
+ };
2701
+ return _createClass(Obj, [{
2702
+ key: "typename",
2703
+ get: function get() {
2704
+ return this.constructor.name;
2705
+ }
2706
+ }]);
2707
+ }();
2708
+ var EmitterObj = /*#__PURE__*/function (_EventEmitter) {
2709
+ function EmitterObj() {
2710
+ var _this2;
2711
+ var _this;
2712
+ _this = _EventEmitter.call(this) || this;
2713
+ // Unfortunately necessary for backwards compatibility
2714
+ (_this2 = _this).init.apply(_this2, arguments);
2715
+ return _this;
2716
+ }
2717
+ _inheritsLoose(EmitterObj, _EventEmitter);
2718
+ var _proto2 = EmitterObj.prototype;
2719
+ _proto2.init = function init() {};
2720
+ EmitterObj.extend = function extend(name, props) {
2721
+ if (typeof name === 'object') {
2722
+ props = name;
2723
+ name = 'anonymous';
2724
+ }
2725
+ return extendClass(this, name, props);
2726
+ };
2727
+ return _createClass(EmitterObj, [{
2728
+ key: "typename",
2729
+ get: function get() {
2730
+ return this.constructor.name;
2731
+ }
2732
+ }]);
2733
+ }(EventEmitter);
2734
+ module.exports = {
2735
+ Obj: Obj,
2736
+ EmitterObj: EmitterObj
2737
+ };
2738
+
2739
+ /***/ }),
2740
+
2741
+ /***/ "./nunjucks/src/precompiled-loader.js":
2742
+ /*!********************************************!*\
2743
+ !*** ./nunjucks/src/precompiled-loader.js ***!
2744
+ \********************************************/
2745
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2746
+
2747
+ "use strict";
2748
+
2749
+
2750
+ function _inheritsLoose(t, o) { t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o); }
2751
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
2752
+ var Loader = __webpack_require__(/*! ./loader */ "./nunjucks/src/loader.js");
2753
+ var PrecompiledLoader = /*#__PURE__*/function (_Loader) {
2754
+ function PrecompiledLoader(compiledTemplates) {
2755
+ var _this;
2756
+ _this = _Loader.call(this) || this;
2757
+ _this.precompiled = compiledTemplates || {};
2758
+ return _this;
2759
+ }
2760
+ _inheritsLoose(PrecompiledLoader, _Loader);
2761
+ var _proto = PrecompiledLoader.prototype;
2762
+ _proto.getSource = function getSource(name) {
2763
+ if (this.precompiled[name]) {
2764
+ return {
2765
+ src: {
2766
+ type: 'code',
2767
+ obj: this.precompiled[name]
2768
+ },
2769
+ path: name
2770
+ };
2771
+ }
2772
+ return null;
2773
+ };
2774
+ return PrecompiledLoader;
2775
+ }(Loader);
2776
+ module.exports = {
2777
+ PrecompiledLoader: PrecompiledLoader
2778
+ };
2779
+
2780
+ /***/ }),
2781
+
2782
+ /***/ "./nunjucks/src/runtime.js":
2783
+ /*!*********************************!*\
2784
+ !*** ./nunjucks/src/runtime.js ***!
2785
+ \*********************************/
2786
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2787
+
2788
+ "use strict";
2789
+
2790
+
2791
+ var lib = __webpack_require__(/*! ./lib */ "./nunjucks/src/lib.js");
2792
+ var arrayFrom = Array.from;
2793
+ var supportsIterators = typeof Symbol === 'function' && Symbol.iterator && typeof arrayFrom === 'function';
2794
+
2795
+ // Frames keep track of scoping both at compile-time and run-time so
2796
+ // we know how to access variables. Block tags can introduce special
2797
+ // variables, for example.
2798
+ var Frame = /*#__PURE__*/function () {
2799
+ function Frame(parent, isolateWrites) {
2800
+ this.variables = Object.create(null);
2801
+ this.parent = parent;
2802
+ this.topLevel = false;
2803
+ // if this is true, writes (set) should never propagate upwards past
2804
+ // this frame to its parent (though reads may).
2805
+ this.isolateWrites = isolateWrites;
2806
+ }
2807
+ var _proto = Frame.prototype;
2808
+ _proto.set = function set(name, val, resolveUp) {
2809
+ // Allow variables with dots by automatically creating the
2810
+ // nested structure
2811
+ var parts = name.split('.');
2812
+ var obj = this.variables;
2813
+ var frame = this;
2814
+ if (resolveUp) {
2815
+ if (frame = this.resolve(parts[0], true)) {
2816
+ frame.set(name, val);
2817
+ return;
2818
+ }
2819
+ }
2820
+ for (var i = 0; i < parts.length - 1; i++) {
2821
+ var id = parts[i];
2822
+ if (!obj[id]) {
2823
+ obj[id] = {};
2824
+ }
2825
+ obj = obj[id];
2826
+ }
2827
+ obj[parts[parts.length - 1]] = val;
2828
+ };
2829
+ _proto.get = function get(name) {
2830
+ var val = this.variables[name];
2831
+ if (val !== undefined) {
2832
+ return val;
2833
+ }
2834
+ return null;
2835
+ };
2836
+ _proto.lookup = function lookup(name) {
2837
+ var p = this.parent;
2838
+ var val = this.variables[name];
2839
+ if (val !== undefined) {
2840
+ return val;
2841
+ }
2842
+ return p && p.lookup(name);
2843
+ };
2844
+ _proto.resolve = function resolve(name, forWrite) {
2845
+ var p = forWrite && this.isolateWrites ? undefined : this.parent;
2846
+ var val = this.variables[name];
2847
+ if (val !== undefined) {
2848
+ return this;
2849
+ }
2850
+ return p && p.resolve(name);
2851
+ };
2852
+ _proto.push = function push(isolateWrites) {
2853
+ return new Frame(this, isolateWrites);
2854
+ };
2855
+ _proto.pop = function pop() {
2856
+ return this.parent;
2857
+ };
2858
+ return Frame;
2859
+ }();
2860
+ function makeMacro(argNames, kwargNames, func) {
2861
+ return function macro() {
2862
+ for (var _len = arguments.length, macroArgs = new Array(_len), _key = 0; _key < _len; _key++) {
2863
+ macroArgs[_key] = arguments[_key];
2864
+ }
2865
+ var argCount = numArgs(macroArgs);
2866
+ var args;
2867
+ var kwargs = getKeywordArgs(macroArgs);
2868
+ if (argCount > argNames.length) {
2869
+ args = macroArgs.slice(0, argNames.length);
2870
+
2871
+ // Positional arguments that should be passed in as
2872
+ // keyword arguments (essentially default values)
2873
+ macroArgs.slice(args.length, argCount).forEach(function (val, i) {
2874
+ if (i < kwargNames.length) {
2875
+ kwargs[kwargNames[i]] = val;
2876
+ }
2877
+ });
2878
+ args.push(kwargs);
2879
+ } else if (argCount < argNames.length) {
2880
+ args = macroArgs.slice(0, argCount);
2881
+ for (var i = argCount; i < argNames.length; i++) {
2882
+ var arg = argNames[i];
2883
+
2884
+ // Keyword arguments that should be passed as
2885
+ // positional arguments, i.e. the caller explicitly
2886
+ // used the name of a positional arg
2887
+ args.push(kwargs[arg]);
2888
+ delete kwargs[arg];
2889
+ }
2890
+ args.push(kwargs);
2891
+ } else {
2892
+ args = macroArgs;
2893
+ }
2894
+ return func.apply(this, args);
2895
+ };
2896
+ }
2897
+ function makeKeywordArgs(obj) {
2898
+ obj.__keywords = true;
2899
+ return obj;
2900
+ }
2901
+ function isKeywordArgs(obj) {
2902
+ return obj && Object.prototype.hasOwnProperty.call(obj, '__keywords');
2903
+ }
2904
+ function getKeywordArgs(args) {
2905
+ var len = args.length;
2906
+ if (len) {
2907
+ var lastArg = args[len - 1];
2908
+ if (isKeywordArgs(lastArg)) {
2909
+ return lastArg;
2910
+ }
2911
+ }
2912
+ return {};
2913
+ }
2914
+ function numArgs(args) {
2915
+ var len = args.length;
2916
+ if (len === 0) {
2917
+ return 0;
2918
+ }
2919
+ var lastArg = args[len - 1];
2920
+ if (isKeywordArgs(lastArg)) {
2921
+ return len - 1;
2922
+ } else {
2923
+ return len;
2924
+ }
2925
+ }
2926
+
2927
+ // A SafeString object indicates that the string should not be
2928
+ // autoescaped. This happens magically because autoescaping only
2929
+ // occurs on primitive string objects.
2930
+ function SafeString(val) {
2931
+ if (typeof val !== 'string') {
2932
+ return val;
2933
+ }
2934
+ this.val = val;
2935
+ this.length = val.length;
2936
+ }
2937
+ SafeString.prototype = Object.create(String.prototype, {
2938
+ length: {
2939
+ writable: true,
2940
+ configurable: true,
2941
+ value: 0
2942
+ }
2943
+ });
2944
+ SafeString.prototype.valueOf = function valueOf() {
2945
+ return this.val;
2946
+ };
2947
+ SafeString.prototype.toString = function toString() {
2948
+ return this.val;
2949
+ };
2950
+ function copySafeness(dest, target) {
2951
+ if (dest instanceof SafeString) {
2952
+ return new SafeString(target);
2953
+ }
2954
+ return target.toString();
2955
+ }
2956
+ function markSafe(val) {
2957
+ var type = typeof val;
2958
+ if (type === 'string') {
2959
+ return new SafeString(val);
2960
+ } else if (type !== 'function') {
2961
+ return val;
2962
+ } else {
2963
+ return function wrapSafe(args) {
2964
+ var ret = val.apply(this, arguments);
2965
+ if (typeof ret === 'string') {
2966
+ return new SafeString(ret);
2967
+ }
2968
+ return ret;
2969
+ };
2970
+ }
2971
+ }
2972
+ function suppressValue(val, autoescape) {
2973
+ val = val !== undefined && val !== null ? val : '';
2974
+ if (autoescape && !(val instanceof SafeString)) {
2975
+ val = lib.escape(val.toString());
2976
+ }
2977
+ return val;
2978
+ }
2979
+ function ensureDefined(val, lineno, colno) {
2980
+ if (val === null || val === undefined) {
2981
+ throw new lib.TemplateError('attempted to output null or undefined value', lineno + 1, colno + 1);
2982
+ }
2983
+ return val;
2984
+ }
2985
+ function memberLookup(obj, val) {
2986
+ if (obj === undefined || obj === null) {
2987
+ return undefined;
2988
+ }
2989
+ if (typeof obj[val] === 'function') {
2990
+ return function () {
2991
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2992
+ args[_key2] = arguments[_key2];
2993
+ }
2994
+ return obj[val].apply(obj, args);
2995
+ };
2996
+ }
2997
+ return obj[val];
2998
+ }
2999
+ function callWrap(obj, name, context, args) {
3000
+ if (!obj) {
3001
+ throw new Error('Unable to call `' + name + '`, which is undefined or falsey');
3002
+ } else if (typeof obj !== 'function') {
3003
+ throw new Error('Unable to call `' + name + '`, which is not a function');
3004
+ }
3005
+ return obj.apply(context, args);
3006
+ }
3007
+ function contextOrFrameLookup(context, frame, name) {
3008
+ var val = frame.lookup(name);
3009
+ return val !== undefined ? val : context.lookup(name);
3010
+ }
3011
+ function handleError(error, lineno, colno) {
3012
+ if (error.lineno) {
3013
+ return error;
3014
+ } else {
3015
+ return new lib.TemplateError(error, lineno, colno);
3016
+ }
3017
+ }
3018
+ function asyncEach(arr, dimen, iter, cb) {
3019
+ if (lib.isArray(arr)) {
3020
+ var len = arr.length;
3021
+ lib.asyncIter(arr, function iterCallback(item, i, next) {
3022
+ switch (dimen) {
3023
+ case 1:
3024
+ iter(item, i, len, next);
3025
+ break;
3026
+ case 2:
3027
+ iter(item[0], item[1], i, len, next);
3028
+ break;
3029
+ case 3:
3030
+ iter(item[0], item[1], item[2], i, len, next);
3031
+ break;
3032
+ default:
3033
+ item.push(i, len, next);
3034
+ iter.apply(this, item);
3035
+ }
3036
+ }, cb);
3037
+ } else {
3038
+ lib.asyncFor(arr, function iterCallback(key, val, i, len, next) {
3039
+ iter(key, val, i, len, next);
3040
+ }, cb);
3041
+ }
3042
+ }
3043
+ function asyncAll(arr, dimen, func, cb) {
3044
+ var finished = 0;
3045
+ var len;
3046
+ var outputArr;
3047
+ function done(i, output) {
3048
+ finished++;
3049
+ outputArr[i] = output;
3050
+ if (finished === len) {
3051
+ cb(null, outputArr.join(''));
3052
+ }
3053
+ }
3054
+ if (lib.isArray(arr)) {
3055
+ len = arr.length;
3056
+ outputArr = new Array(len);
3057
+ if (len === 0) {
3058
+ cb(null, '');
3059
+ } else {
3060
+ for (var i = 0; i < arr.length; i++) {
3061
+ var item = arr[i];
3062
+ switch (dimen) {
3063
+ case 1:
3064
+ func(item, i, len, done);
3065
+ break;
3066
+ case 2:
3067
+ func(item[0], item[1], i, len, done);
3068
+ break;
3069
+ case 3:
3070
+ func(item[0], item[1], item[2], i, len, done);
3071
+ break;
3072
+ default:
3073
+ item.push(i, len, done);
3074
+ func.apply(this, item);
3075
+ }
3076
+ }
3077
+ }
3078
+ } else {
3079
+ var keys = lib.keys(arr || {});
3080
+ len = keys.length;
3081
+ outputArr = new Array(len);
3082
+ if (len === 0) {
3083
+ cb(null, '');
3084
+ } else {
3085
+ for (var _i = 0; _i < keys.length; _i++) {
3086
+ var k = keys[_i];
3087
+ func(k, arr[k], _i, len, done);
3088
+ }
3089
+ }
3090
+ }
3091
+ }
3092
+ function fromIterator(arr) {
3093
+ if (typeof arr !== 'object' || arr === null || lib.isArray(arr)) {
3094
+ return arr;
3095
+ } else if (supportsIterators && Symbol.iterator in arr) {
3096
+ return arrayFrom(arr);
3097
+ } else {
3098
+ return arr;
3099
+ }
3100
+ }
3101
+ module.exports = {
3102
+ Frame: Frame,
3103
+ makeMacro: makeMacro,
3104
+ makeKeywordArgs: makeKeywordArgs,
3105
+ numArgs: numArgs,
3106
+ suppressValue: suppressValue,
3107
+ ensureDefined: ensureDefined,
3108
+ memberLookup: memberLookup,
3109
+ contextOrFrameLookup: contextOrFrameLookup,
3110
+ callWrap: callWrap,
3111
+ handleError: handleError,
3112
+ isArray: lib.isArray,
3113
+ keys: lib.keys,
3114
+ SafeString: SafeString,
3115
+ copySafeness: copySafeness,
3116
+ markSafe: markSafe,
3117
+ asyncEach: asyncEach,
3118
+ asyncAll: asyncAll,
3119
+ inOperator: lib.inOperator,
3120
+ fromIterator: fromIterator
3121
+ };
3122
+
3123
+ /***/ }),
3124
+
3125
+ /***/ "./nunjucks/src/tests.js":
3126
+ /*!*******************************!*\
3127
+ !*** ./nunjucks/src/tests.js ***!
3128
+ \*******************************/
3129
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3130
+
3131
+ "use strict";
3132
+
3133
+
3134
+ var SafeString = (__webpack_require__(/*! ./runtime */ "./nunjucks/src/runtime.js").SafeString);
3135
+
3136
+ /**
3137
+ * Returns `true` if the object is a function, otherwise `false`.
3138
+ * @param { any } value
3139
+ * @returns { boolean }
3140
+ */
3141
+ function callable(value) {
3142
+ return typeof value === 'function';
3143
+ }
3144
+ exports.callable = callable;
3145
+
3146
+ /**
3147
+ * Returns `true` if the object is strictly not `undefined`.
3148
+ * @param { any } value
3149
+ * @returns { boolean }
3150
+ */
3151
+ function defined(value) {
3152
+ return value !== undefined;
3153
+ }
3154
+ exports.defined = defined;
3155
+
3156
+ /**
3157
+ * Returns `true` if the operand (one) is divisble by the test's argument
3158
+ * (two).
3159
+ * @param { number } one
3160
+ * @param { number } two
3161
+ * @returns { boolean }
3162
+ */
3163
+ function divisibleby(one, two) {
3164
+ return one % two === 0;
3165
+ }
3166
+ exports.divisibleby = divisibleby;
3167
+
3168
+ /**
3169
+ * Returns true if the string has been escaped (i.e., is a SafeString).
3170
+ * @param { any } value
3171
+ * @returns { boolean }
3172
+ */
3173
+ function escaped(value) {
3174
+ return value instanceof SafeString;
3175
+ }
3176
+ exports.escaped = escaped;
3177
+
3178
+ /**
3179
+ * Returns `true` if the arguments are strictly equal.
3180
+ * @param { any } one
3181
+ * @param { any } two
3182
+ */
3183
+ function equalto(one, two) {
3184
+ return one === two;
3185
+ }
3186
+ exports.equalto = equalto;
3187
+
3188
+ // Aliases
3189
+ exports.eq = exports.equalto;
3190
+ exports.sameas = exports.equalto;
3191
+
3192
+ /**
3193
+ * Returns `true` if the value is evenly divisible by 2.
3194
+ * @param { number } value
3195
+ * @returns { boolean }
3196
+ */
3197
+ function even(value) {
3198
+ return value % 2 === 0;
3199
+ }
3200
+ exports.even = even;
3201
+
3202
+ /**
3203
+ * Returns `true` if the value is falsy - if I recall correctly, '', 0, false,
3204
+ * undefined, NaN or null. I don't know if we should stick to the default JS
3205
+ * behavior or attempt to replicate what Python believes should be falsy (i.e.,
3206
+ * empty arrays, empty dicts, not 0...).
3207
+ * @param { any } value
3208
+ * @returns { boolean }
3209
+ */
3210
+ function falsy(value) {
3211
+ return !value;
3212
+ }
3213
+ exports.falsy = falsy;
3214
+
3215
+ /**
3216
+ * Returns `true` if the operand (one) is greater or equal to the test's
3217
+ * argument (two).
3218
+ * @param { number } one
3219
+ * @param { number } two
3220
+ * @returns { boolean }
3221
+ */
3222
+ function ge(one, two) {
3223
+ return one >= two;
3224
+ }
3225
+ exports.ge = ge;
3226
+
3227
+ /**
3228
+ * Returns `true` if the operand (one) is greater than the test's argument
3229
+ * (two).
3230
+ * @param { number } one
3231
+ * @param { number } two
3232
+ * @returns { boolean }
3233
+ */
3234
+ function greaterthan(one, two) {
3235
+ return one > two;
3236
+ }
3237
+ exports.greaterthan = greaterthan;
3238
+
3239
+ // alias
3240
+ exports.gt = exports.greaterthan;
3241
+
3242
+ /**
3243
+ * Returns `true` if the operand (one) is less than or equal to the test's
3244
+ * argument (two).
3245
+ * @param { number } one
3246
+ * @param { number } two
3247
+ * @returns { boolean }
3248
+ */
3249
+ function le(one, two) {
3250
+ return one <= two;
3251
+ }
3252
+ exports.le = le;
3253
+
3254
+ /**
3255
+ * Returns `true` if the operand (one) is less than the test's passed argument
3256
+ * (two).
3257
+ * @param { number } one
3258
+ * @param { number } two
3259
+ * @returns { boolean }
3260
+ */
3261
+ function lessthan(one, two) {
3262
+ return one < two;
3263
+ }
3264
+ exports.lessthan = lessthan;
3265
+
3266
+ // alias
3267
+ exports.lt = exports.lessthan;
3268
+
3269
+ /**
3270
+ * Returns `true` if the string is lowercased.
3271
+ * @param { string } value
3272
+ * @returns { boolean }
3273
+ */
3274
+ function lower(value) {
3275
+ return value.toLowerCase() === value;
3276
+ }
3277
+ exports.lower = lower;
3278
+
3279
+ /**
3280
+ * Returns `true` if the operand (one) is less than or equal to the test's
3281
+ * argument (two).
3282
+ * @param { number } one
3283
+ * @param { number } two
3284
+ * @returns { boolean }
3285
+ */
3286
+ function ne(one, two) {
3287
+ return one !== two;
3288
+ }
3289
+ exports.ne = ne;
3290
+
3291
+ /**
3292
+ * Returns true if the value is strictly equal to `null`.
3293
+ * @param { any }
3294
+ * @returns { boolean }
3295
+ */
3296
+ function nullTest(value) {
3297
+ return value === null;
3298
+ }
3299
+ exports["null"] = nullTest;
3300
+
3301
+ /**
3302
+ * Returns true if value is a number.
3303
+ * @param { any }
3304
+ * @returns { boolean }
3305
+ */
3306
+ function number(value) {
3307
+ return typeof value === 'number';
3308
+ }
3309
+ exports.number = number;
3310
+
3311
+ /**
3312
+ * Returns `true` if the value is *not* evenly divisible by 2.
3313
+ * @param { number } value
3314
+ * @returns { boolean }
3315
+ */
3316
+ function odd(value) {
3317
+ return value % 2 === 1;
3318
+ }
3319
+ exports.odd = odd;
3320
+
3321
+ /**
3322
+ * Returns `true` if the value is a string, `false` if not.
3323
+ * @param { any } value
3324
+ * @returns { boolean }
3325
+ */
3326
+ function string(value) {
3327
+ return typeof value === 'string';
3328
+ }
3329
+ exports.string = string;
3330
+
3331
+ /**
3332
+ * Returns `true` if the value is not in the list of things considered falsy:
3333
+ * '', null, undefined, 0, NaN and false.
3334
+ * @param { any } value
3335
+ * @returns { boolean }
3336
+ */
3337
+ function truthy(value) {
3338
+ return !!value;
3339
+ }
3340
+ exports.truthy = truthy;
3341
+
3342
+ /**
3343
+ * Returns `true` if the value is undefined.
3344
+ * @param { any } value
3345
+ * @returns { boolean }
3346
+ */
3347
+ function undefinedTest(value) {
3348
+ return value === undefined;
3349
+ }
3350
+ exports.undefined = undefinedTest;
3351
+
3352
+ /**
3353
+ * Returns `true` if the string is uppercased.
3354
+ * @param { string } value
3355
+ * @returns { boolean }
3356
+ */
3357
+ function upper(value) {
3358
+ return value.toUpperCase() === value;
3359
+ }
3360
+ exports.upper = upper;
3361
+
3362
+ /**
3363
+ * If ES6 features are available, returns `true` if the value implements the
3364
+ * `Symbol.iterator` method. If not, it's a string or Array.
3365
+ *
3366
+ * Could potentially cause issues if a browser exists that has Set and Map but
3367
+ * not Symbol.
3368
+ *
3369
+ * @param { any } value
3370
+ * @returns { boolean }
3371
+ */
3372
+ function iterable(value) {
3373
+ if (typeof Symbol !== 'undefined') {
3374
+ return !!value[Symbol.iterator];
3375
+ } else {
3376
+ return Array.isArray(value) || typeof value === 'string';
3377
+ }
3378
+ }
3379
+ exports.iterable = iterable;
3380
+
3381
+ /**
3382
+ * If ES6 features are available, returns `true` if the value is an object hash
3383
+ * or an ES6 Map. Otherwise just return if it's an object hash.
3384
+ * @param { any } value
3385
+ * @returns { boolean }
3386
+ */
3387
+ function mapping(value) {
3388
+ // only maps and object hashes
3389
+ var bool = value !== null && value !== undefined && typeof value === 'object' && !Array.isArray(value);
3390
+ if (Set) {
3391
+ return bool && !(value instanceof Set);
3392
+ } else {
3393
+ return bool;
3394
+ }
3395
+ }
3396
+ exports.mapping = mapping;
3397
+
3398
+ /***/ })
3399
+
3400
+ /******/ });
3401
+ /************************************************************************/
3402
+ /******/ // The module cache
3403
+ /******/ var __webpack_module_cache__ = {};
3404
+ /******/
3405
+ /******/ // The require function
3406
+ /******/ function __webpack_require__(moduleId) {
3407
+ /******/ // Check if module is in cache
3408
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
3409
+ /******/ if (cachedModule !== undefined) {
3410
+ /******/ return cachedModule.exports;
3411
+ /******/ }
3412
+ /******/ // Create a new module (and put it into the cache)
3413
+ /******/ var module = __webpack_module_cache__[moduleId] = {
3414
+ /******/ // no module.id needed
3415
+ /******/ // no module.loaded needed
3416
+ /******/ exports: {}
3417
+ /******/ };
3418
+ /******/
3419
+ /******/ // Execute the module function
3420
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
3421
+ /******/
3422
+ /******/ // Return the exports of the module
3423
+ /******/ return module.exports;
3424
+ /******/ }
3425
+ /******/
3426
+ /************************************************************************/
3427
+ /******/ /* webpack/runtime/global */
3428
+ /******/ !function() {
3429
+ /******/ __webpack_require__.g = (function() {
3430
+ /******/ if (typeof globalThis === 'object') return globalThis;
3431
+ /******/ try {
3432
+ /******/ return this || new Function('return this')();
3433
+ /******/ } catch (e) {
3434
+ /******/ if (typeof window === 'object') return window;
3435
+ /******/ }
3436
+ /******/ })();
3437
+ /******/ }();
3438
+ /******/
3439
+ /************************************************************************/
3440
+ /******/
3441
+ /******/ // startup
3442
+ /******/ // Load entry module and return exports
3443
+ /******/ // This entry module is referenced by other modules so it can't be inlined
3444
+ /******/ var __webpack_exports__ = __webpack_require__("./nunjucks/index.js");
3445
+ /******/
3446
+ /******/ return __webpack_exports__;
3447
+ /******/ })()
3448
+ ;
3449
+ });
3450
+ //# sourceMappingURL=nunjucks-slim.js.map