UNPKG

45 kBJavaScriptView Raw
1;(function(){var require = function (file, cwd) {
2 var resolved = require.resolve(file, cwd || '/');
3 var mod = require.modules[resolved];
4 if (!mod) throw new Error(
5 'Failed to resolve module ' + file + ', tried ' + resolved
6 );
7 var res = mod._cached ? mod._cached : mod();
8 return res;
9}
10var __require = require;
11
12require.paths = [];
13require.modules = {};
14require.extensions = [".js",".coffee"];
15
16require._core = {
17 'assert': true,
18 'events': true,
19 'fs': true,
20 'path': true,
21 'vm': true
22};
23
24require.resolve = (function () {
25 return function (x, cwd) {
26 if (!cwd) cwd = '/';
27
28 if (require._core[x]) return x;
29 var path = require.modules.path();
30 var y = cwd || '.';
31
32 if (x.match(/^(?:\.\.?\/|\/)/)) {
33 var m = loadAsFileSync(path.resolve(y, x))
34 || loadAsDirectorySync(path.resolve(y, x));
35 if (m) return m;
36 }
37
38 var n = loadNodeModulesSync(x, y);
39 if (n) return n;
40
41 throw new Error("Cannot find module '" + x + "'");
42
43 function loadAsFileSync (x) {
44 if (require.modules[x]) {
45 return x;
46 }
47
48 for (var i = 0; i < require.extensions.length; i++) {
49 var ext = require.extensions[i];
50 if (require.modules[x + ext]) return x + ext;
51 }
52 }
53
54 function loadAsDirectorySync (x) {
55 x = x.replace(/\/+$/, '');
56 var pkgfile = x + '/package.json';
57 if (require.modules[pkgfile]) {
58 var pkg = require.modules[pkgfile]();
59 var b = pkg.browserify;
60 if (typeof b === 'object' && b.main) {
61 var m = loadAsFileSync(path.resolve(x, b.main));
62 if (m) return m;
63 }
64 else if (typeof b === 'string') {
65 var m = loadAsFileSync(path.resolve(x, b));
66 if (m) return m;
67 }
68 else if (pkg.main) {
69 var m = loadAsFileSync(path.resolve(x, pkg.main));
70 if (m) return m;
71 }
72 }
73
74 return loadAsFileSync(x + '/index');
75 }
76
77 function loadNodeModulesSync (x, start) {
78 var dirs = nodeModulesPathsSync(start);
79 for (var i = 0; i < dirs.length; i++) {
80 var dir = dirs[i];
81 var m = loadAsFileSync(dir + '/' + x);
82 if (m) return m;
83 var n = loadAsDirectorySync(dir + '/' + x);
84 if (n) return n;
85 }
86
87 var m = loadAsFileSync(x);
88 if (m) return m;
89 }
90
91 function nodeModulesPathsSync (start) {
92 var parts;
93 if (start === '/') parts = [ '' ];
94 else parts = path.normalize(start).split('/');
95
96 var dirs = [];
97 for (var i = parts.length - 1; i >= 0; i--) {
98 if (parts[i] === 'node_modules') continue;
99 var dir = parts.slice(0, i + 1).join('/') + '/node_modules';
100 dirs.push(dir);
101 }
102
103 return dirs;
104 }
105 };
106})();
107
108require.alias = function (from, to) {
109 var path = require.modules.path();
110 var res = null;
111 try {
112 res = require.resolve(from + '/package.json', '/');
113 }
114 catch (err) {
115 res = require.resolve(from, '/');
116 }
117 var basedir = path.dirname(res);
118
119 var keys = Object_keys(require.modules);
120
121 for (var i = 0; i < keys.length; i++) {
122 var key = keys[i];
123 if (key.slice(0, basedir.length + 1) === basedir + '/') {
124 var f = key.slice(basedir.length);
125 require.modules[to + f] = require.modules[basedir + f];
126 }
127 else if (key === basedir) {
128 require.modules[to] = require.modules[basedir];
129 }
130 }
131};
132
133require.define = function (filename, fn) {
134 var dirname = require._core[filename]
135 ? ''
136 : require.modules.path().dirname(filename)
137 ;
138
139 var require_ = function (file) { return require(file, dirname) };
140 require_.resolve = function (name) {
141 return require.resolve(name, dirname);
142 };
143 require_.modules = require.modules;
144 var module_ = { exports : {} };
145
146 require.modules[filename] = function () {
147 fn.call(
148 module_.exports,
149 require_,
150 module_,
151 module_.exports,
152 dirname,
153 filename
154 );
155 require.modules[filename]._cached = module_.exports;
156 return module_.exports;
157 };
158};
159
160var Object_keys = Object.keys || function (obj) {
161 var res = [];
162 for (var key in obj) res.push(key)
163 return res;
164};
165
166if (typeof process === 'undefined') process = {};
167
168if (!process.nextTick) process.nextTick = function (fn) {
169 setTimeout(fn, 0);
170};
171
172if (!process.title) process.title = 'browser';
173
174if (!process.binding) process.binding = function (name) {
175 if (name === 'evals') return require('vm')
176 else throw new Error('No such module')
177};
178
179if (!process.cwd) process.cwd = function () { return '.' };
180
181require.define("path", function (require, module, exports, __dirname, __filename) {
182 function filter (xs, fn) {
183 var res = [];
184 for (var i = 0; i < xs.length; i++) {
185 if (fn(xs[i], i, xs)) res.push(xs[i]);
186 }
187 return res;
188}
189
190// resolves . and .. elements in a path array with directory names there
191// must be no slashes, empty elements, or device names (c:\) in the array
192// (so also no leading and trailing slashes - it does not distinguish
193// relative and absolute paths)
194function normalizeArray(parts, allowAboveRoot) {
195 // if the path tries to go above the root, `up` ends up > 0
196 var up = 0;
197 for (var i = parts.length; i >= 0; i--) {
198 var last = parts[i];
199 if (last == '.') {
200 parts.splice(i, 1);
201 } else if (last === '..') {
202 parts.splice(i, 1);
203 up++;
204 } else if (up) {
205 parts.splice(i, 1);
206 up--;
207 }
208 }
209
210 // if the path is allowed to go above the root, restore leading ..s
211 if (allowAboveRoot) {
212 for (; up--; up) {
213 parts.unshift('..');
214 }
215 }
216
217 return parts;
218}
219
220// Regex to split a filename into [*, dir, basename, ext]
221// posix version
222var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;
223
224// path.resolve([from ...], to)
225// posix version
226exports.resolve = function() {
227var resolvedPath = '',
228 resolvedAbsolute = false;
229
230for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
231 var path = (i >= 0)
232 ? arguments[i]
233 : process.cwd();
234
235 // Skip empty and invalid entries
236 if (typeof path !== 'string' || !path) {
237 continue;
238 }
239
240 resolvedPath = path + '/' + resolvedPath;
241 resolvedAbsolute = path.charAt(0) === '/';
242}
243
244// At this point the path should be resolved to a full absolute path, but
245// handle relative paths to be safe (might happen when process.cwd() fails)
246
247// Normalize the path
248resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
249 return !!p;
250 }), !resolvedAbsolute).join('/');
251
252 return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
253};
254
255// path.normalize(path)
256// posix version
257exports.normalize = function(path) {
258var isAbsolute = path.charAt(0) === '/',
259 trailingSlash = path.slice(-1) === '/';
260
261// Normalize the path
262path = normalizeArray(filter(path.split('/'), function(p) {
263 return !!p;
264 }), !isAbsolute).join('/');
265
266 if (!path && !isAbsolute) {
267 path = '.';
268 }
269 if (path && trailingSlash) {
270 path += '/';
271 }
272
273 return (isAbsolute ? '/' : '') + path;
274};
275
276
277// posix version
278exports.join = function() {
279 var paths = Array.prototype.slice.call(arguments, 0);
280 return exports.normalize(filter(paths, function(p, index) {
281 return p && typeof p === 'string';
282 }).join('/'));
283};
284
285
286exports.dirname = function(path) {
287 var dir = splitPathRe.exec(path)[1] || '';
288 var isWindows = false;
289 if (!dir) {
290 // No dirname
291 return '.';
292 } else if (dir.length === 1 ||
293 (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) {
294 // It is just a slash or a drive letter with a slash
295 return dir;
296 } else {
297 // It is a full dirname, strip trailing slash
298 return dir.substring(0, dir.length - 1);
299 }
300};
301
302
303exports.basename = function(path, ext) {
304 var f = splitPathRe.exec(path)[2] || '';
305 // TODO: make this comparison case-insensitive on windows?
306 if (ext && f.substr(-1 * ext.length) === ext) {
307 f = f.substr(0, f.length - ext.length);
308 }
309 return f;
310};
311
312
313exports.extname = function(path) {
314 return splitPathRe.exec(path)[3] || '';
315};
316
317});
318
319require.define("/dynamictemplate.js", function (require, module, exports, __dirname, __filename) {
320 (function() {
321 var Builder, Tag, Template, _ref;
322
323 _ref = require('asyncxml'), Tag = _ref.Tag, Builder = _ref.Builder;
324
325 Template = require('./template');
326
327 module.exports = {
328 Tag: Tag,
329 Builder: Builder,
330 Template: Template
331 };
332
333 if (process.title === 'browser') {
334 (function() {
335 if (this.dynamictemplate != null) {
336 this.dynamictemplate.Template = Template;
337 this.dynamictemplate.Builder = Builder;
338 return this.dynamictemplate.Tag = Tag;
339 } else {
340 return this.dynamictemplate = module.exports;
341 }
342 }).call(window);
343 }
344
345}).call(this);
346
347});
348
349require.define("/node_modules/asyncxml/package.json", function (require, module, exports, __dirname, __filename) {
350 module.exports = {"name":"asyncxml","description":"async xml builder and generator","version":"0.4.0","homepage":"https://github.com/dodo/node-asyncxml","author":"dodo (https://github.com/dodo)","repository":{"type":"git","url":"git://github.com/dodo/node-asyncxml.git"},"main":"asyncxml.js","engines":{"node":">= 0.4.x"},"keywords":["async","xml","generation","stream","browser"],"scripts":{"test":"cake build && nodeunit test","prepublish":"cake build"},"devDependencies":{"coffee-script":">= 1.1.2","muffin":">= 0.2.6","browserify":"1.6.1","scopify":">= 0.1.0","dt-stream":">= 0.1.1","nodeunit":">= 0.7.4"},"licenses":[{"type":"MIT","url":"http://github.com/dodo/node-asyncxml/raw/master/LICENSE"}]}
351});
352
353require.define("/node_modules/asyncxml/asyncxml.js", function (require, module, exports, __dirname, __filename) {
354
355module.exports = require('./lib/asyncxml')
356
357});
358
359require.define("/node_modules/asyncxml/lib/asyncxml.js", function (require, module, exports, __dirname, __filename) {
360 (function() {
361 var Builder, Tag, _ref;
362
363 _ref = require('./xml'), Tag = _ref.Tag, Builder = _ref.Builder;
364
365 this.asyncxml = module.exports = {
366 Tag: Tag,
367 Builder: Builder
368 };
369
370}).call(this);
371
372});
373
374require.define("/node_modules/asyncxml/lib/xml.js", function (require, module, exports, __dirname, __filename) {
375 (function() {
376 var Builder, EVENTS, EventEmitter, Tag, add_tag, connect_tags, deep_merge, new_attrs, new_tag, parse_args, safe, sync_tag, _ref;
377 var __slice = Array.prototype.slice, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
378
379 EventEmitter = require('events').EventEmitter;
380
381 _ref = require('./util'), deep_merge = _ref.deep_merge, new_attrs = _ref.new_attrs, safe = _ref.safe;
382
383 EVENTS = ['add', 'attr', 'data', 'text', 'raw', 'show', 'hide', 'remove', 'replace', 'close'];
384
385 parse_args = function(name, attrs, children, opts) {
386 var _ref2;
387 if (typeof attrs !== 'object') {
388 _ref2 = [children, attrs, {}], opts = _ref2[0], children = _ref2[1], attrs = _ref2[2];
389 } else {
390 if (attrs == null) attrs = {};
391 }
392 if (opts == null) opts = {};
393 return [name, attrs, children, opts];
394 };
395
396 connect_tags = function(parent, child) {
397 var dispose, listeners, pipe, remove, replace, wire;
398 listeners = {};
399 pipe = function(event) {
400 return typeof child.on === "function" ? child.on(event, listeners[event] = function() {
401 return parent.emit.apply(parent, [event].concat(__slice.call(arguments)));
402 }) : void 0;
403 };
404 wire = function() {
405 var event, _i, _len, _results;
406 _results = [];
407 for (_i = 0, _len = EVENTS.length; _i < _len; _i++) {
408 event = EVENTS[_i];
409 _results.push(pipe(event));
410 }
411 return _results;
412 };
413 dispose = function() {
414 var event, listener, _i, _len, _results;
415 _results = [];
416 for (_i = 0, _len = EVENTS.length; _i < _len; _i++) {
417 event = EVENTS[_i];
418 if ((listener = listeners[event]) != null) {
419 if (typeof child.removeListener === "function") {
420 child.removeListener(event, listener);
421 }
422 _results.push(listeners[event] = void 0);
423 } else {
424 _results.push(void 0);
425 }
426 }
427 return _results;
428 };
429 remove = function() {
430 dispose();
431 if (this === child) {
432 parent.removeListener('removed', remove);
433 } else {
434 child.removeListener('removed', remove);
435 }
436 parent.removeListener('replaced', replace);
437 return child.removeListener('replaced', replace);
438 };
439 replace = function(tag) {
440 if (this === child) {
441 remove.call(parent);
442 child = tag;
443 wire();
444 } else {
445 parent.removeListener('removed', remove);
446 parent = tag;
447 }
448 tag.once('replaced', replace);
449 return tag.once('removed', remove);
450 };
451 wire();
452 child.once('removed', remove);
453 parent.once('removed', remove);
454 child.once('replaced', replace);
455 return parent.once('replaced', replace);
456 };
457
458 add_tag = function(newtag, callback) {
459 var wire_tag;
460 var _this = this;
461 if (newtag == null) return callback != null ? callback.call(this) : void 0;
462 wire_tag = function(_, tag) {
463 var _ref2, _ref3;
464 if ((_ref2 = tag.builder) == null) tag.builder = _this.builder;
465 if ((_ref3 = tag.parent) == null) tag.parent = _this;
466 connect_tags(_this, tag);
467 _this.emit('add', _this, tag);
468 _this.emit('new', tag);
469 _this.isempty = false;
470 if (tag.closed) if (typeof tag.emit === "function") tag.emit('close', tag);
471 return callback != null ? callback.call(_this, tag) : void 0;
472 };
473 if (this.builder != null) {
474 return this.builder.approve('new', this, newtag, wire_tag);
475 } else {
476 return wire_tag(this, newtag);
477 }
478 };
479
480 new_tag = function() {
481 var TagInstance, attrs, children, name, newtag, opts, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;
482 _ref2 = parse_args.apply(null, arguments), name = _ref2[0], attrs = _ref2[1], children = _ref2[2], opts = _ref2[3];
483 if ((_ref3 = opts.level) == null) opts.level = this.level + 1;
484 opts = deep_merge((_ref4 = (_ref5 = this.builder) != null ? _ref5.opts : void 0) != null ? _ref4 : {}, opts);
485 opts.builder = this.builder;
486 TagInstance = (_ref6 = (_ref7 = this.builder) != null ? _ref7.Tag : void 0) != null ? _ref6 : Tag;
487 newtag = new TagInstance(name, attrs, null, opts);
488 newtag.parent = this;
489 add_tag.call(this, newtag, function(tag) {
490 if (children != null) return tag.children(children, opts);
491 });
492 return newtag;
493 };
494
495 sync_tag = function() {
496 var attrs, children, name, opts, self_ending_children_scope, _ref2;
497 _ref2 = parse_args.apply(null, arguments), name = _ref2[0], attrs = _ref2[1], children = _ref2[2], opts = _ref2[3];
498 self_ending_children_scope = function() {
499 this.children(children);
500 return this.end();
501 };
502 return new_tag.call(this, name, attrs, self_ending_children_scope, opts);
503 };
504
505 Tag = (function() {
506
507 __extends(Tag, EventEmitter);
508
509 function Tag() {
510 this.ready = __bind(this.ready, this);
511 this.remove = __bind(this.remove, this);
512 this.replace = __bind(this.replace, this);
513 this.add = __bind(this.add, this);
514 this.toString = __bind(this.toString, this);
515 this.end = __bind(this.end, this);
516 this.hide = __bind(this.hide, this);
517 this.show = __bind(this.show, this);
518 this.up = __bind(this.up, this);
519 this.write = __bind(this.write, this);
520 this.raw = __bind(this.raw, this);
521 this.text = __bind(this.text, this);
522 this.children = __bind(this.children, this);
523 this.removeAttr = __bind(this.removeAttr, this);
524 this.attr = __bind(this.attr, this);
525 var children, opts, _ref2, _ref3, _ref4;
526 _ref2 = parse_args.apply(null, arguments), this.name = _ref2[0], this.attrs = _ref2[1], children = _ref2[2], opts = _ref2[3];
527 this.pretty = (_ref3 = opts.pretty) != null ? _ref3 : false;
528 this.level = (_ref4 = opts.level) != null ? _ref4 : 0;
529 this.builder = opts.builder;
530 this.setMaxListeners(0);
531 this.parent = this.builder;
532 this.closed = false;
533 this.writable = true;
534 this.hidden = false;
535 this.isready = false;
536 this.isempty = true;
537 this.content = "";
538 this.children(children, opts);
539 this.$tag = sync_tag;
540 this.tag = new_tag;
541 }
542
543 Tag.prototype.attr = function(key, value) {
544 var attr, k, v, _ref2;
545 if (typeof key === 'string') {
546 if (!(value != null) && ((attr = (_ref2 = this.builder) != null ? _ref2.query('attr', this, key) : void 0) != null)) {
547 if (attr !== void 0) this.attrs[key] = attr;
548 return attr;
549 }
550 this.attrs[key] = value;
551 this.emit('attr', this, key, value);
552 } else {
553 for (k in key) {
554 if (!__hasProp.call(key, k)) continue;
555 v = key[k];
556 if (v !== void 0) {
557 this.attrs[k] = v;
558 } else {
559 delete this.attr[key];
560 }
561 this.emit('attr', this, k, v);
562 }
563 }
564 return this;
565 };
566
567 Tag.prototype.removeAttr = function() {
568 var key, keys, _i, _len;
569 keys = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
570 for (_i = 0, _len = keys.length; _i < _len; _i++) {
571 key = keys[_i];
572 delete this.attrs[key];
573 this.emit('attr', this, key, void 0);
574 }
575 return this;
576 };
577
578 Tag.prototype.children = function(children) {
579 if (children == null) return this;
580 if (typeof children === 'function') {
581 children.call(this);
582 } else {
583 this.text(children);
584 }
585 return this;
586 };
587
588 Tag.prototype.text = function(content, opts) {
589 var _ref2;
590 if (opts == null) opts = {};
591 if (content == null) {
592 return this.content = (_ref2 = this.builder) != null ? _ref2.query('text', this) : void 0;
593 }
594 if (opts.escape) content = safe(content);
595 if (opts.append) {
596 this.content += content;
597 } else {
598 this.content = content;
599 }
600 this.emit('text', this, content);
601 this.isempty = false;
602 return this;
603 };
604
605 Tag.prototype.raw = function(html, opts) {
606 if (opts == null) opts = {};
607 this.emit('raw', this, html);
608 this.isempty = false;
609 return this;
610 };
611
612 Tag.prototype.write = function(content, _arg) {
613 var append, escape, _ref2;
614 _ref2 = _arg != null ? _arg : {}, escape = _ref2.escape, append = _ref2.append;
615 if (escape) content = safe(content);
616 if (content) this.emit('data', this, "" + content);
617 if (append != null ? append : true) {
618 this.content += content;
619 } else {
620 this.content = content;
621 }
622 this.isempty = false;
623 return true;
624 };
625
626 Tag.prototype.up = function(opts) {
627 var _ref2;
628 if (opts == null) opts = {};
629 if ((_ref2 = opts.end) == null) opts.end = true;
630 if (opts.end) this.end.apply(this, arguments);
631 return this.parent;
632 };
633
634 Tag.prototype.show = function() {
635 this.hidden = false;
636 this.emit('show', this);
637 return this;
638 };
639
640 Tag.prototype.hide = function() {
641 this.hidden = true;
642 this.emit('hide', this);
643 return this;
644 };
645
646 Tag.prototype.end = function() {
647 var close_tag;
648 var _this = this;
649 if (!this.closed) {
650 this.closed = 'approving';
651 close_tag = function() {
652 var set_ready;
653 if (_this.isempty) {
654 _this.closed = 'self';
655 } else {
656 _this.closed = true;
657 }
658 _this.emit('close', _this);
659 _this.emit('end');
660 _this.writable = false;
661 set_ready = function() {
662 _this.isready = true;
663 return _this.emit('ready');
664 };
665 if (_this.builder != null) {
666 return _this.builder.approve('ready', _this, set_ready);
667 } else {
668 return set_ready();
669 }
670 };
671 if (this.builder != null) {
672 this.builder.approve('end', this, close_tag);
673 } else {
674 close_tag(this, this);
675 }
676 } else if (this.closed === 'approving') {} else if (this.closed === 'removed') {
677 this.emit('end');
678 this.writable = false;
679 } else {
680 this.closed = true;
681 this.writable = false;
682 }
683 return this;
684 };
685
686 Tag.prototype.toString = function() {
687 return ("<" + this.name + (new_attrs(this.attrs))) + (this.closed === 'self' ? "/>" : this.closed ? ">" + this.content + "</" + this.name + ">" : ">" + this.content);
688 };
689
690 Tag.prototype.add = function(rawtag, callback) {
691 var tag, _ref2;
692 tag = (_ref2 = this.builder) != null ? _ref2.query('tag', this, rawtag) : void 0;
693 if (!((tag != null) || (this.builder != null))) tag = rawtag;
694 add_tag.call(this, tag, callback);
695 return this;
696 };
697
698 Tag.prototype.replace = function(rawtag) {
699 var tag, _ref2, _ref3, _ref4;
700 tag = (_ref2 = this.builder) != null ? _ref2.query('tag', this, rawtag) : void 0;
701 if (!((tag != null) || (this.builder != null))) tag = rawtag;
702 if (this === tag) return this;
703 if ((_ref3 = tag.parent) == null) tag.parent = this.parent;
704 if ((_ref4 = tag.builder) == null) tag.builder = this.builder;
705 this.emit('replace', this, tag);
706 if (this.builder === tag.builder) this.builder = null;
707 this.parent = null;
708 this.emit('replaced', tag);
709 return tag;
710 };
711
712 Tag.prototype.remove = function() {
713 if (!this.closed) this.closed = 'removed';
714 this.emit('remove', this);
715 this.emit('removed');
716 this.removeAllListeners();
717 return this;
718 };
719
720 Tag.prototype.ready = function(callback) {
721 if (this.isready) {
722 if (callback != null) callback.call(this);
723 return this;
724 }
725 this.once('ready', callback);
726 return this;
727 };
728
729 return Tag;
730
731 })();
732
733 Builder = (function() {
734
735 __extends(Builder, EventEmitter);
736
737 function Builder(opts) {
738 var _base, _ref2, _ref3;
739 this.opts = opts != null ? opts : {};
740 this.ready = __bind(this.ready, this);
741 this.end = __bind(this.end, this);
742 this.add = __bind(this.add, this);
743 this.builder = this;
744 this.checkers = {};
745 this.closed = false;
746 if ((_ref2 = (_base = this.opts).pretty) == null) _base.pretty = false;
747 this.level = (_ref3 = this.opts.level) != null ? _ref3 : -1;
748 this.setMaxListeners(0);
749 this.Tag = Tag;
750 this.tag = new_tag;
751 this.$tag = sync_tag;
752 }
753
754 Builder.prototype.toString = function() {
755 return "[object AsyncXMLBuilder]";
756 };
757
758 Builder.prototype.add = function(rawtag, callback) {
759 var tag;
760 tag = this.query('tag', this, rawtag);
761 if (tag == null) tag = rawtag;
762 add_tag.call(this, tag, callback);
763 return this;
764 };
765
766 Builder.prototype.end = function() {
767 this.closed = true;
768 this.emit('close', this);
769 this.emit('end');
770 return this;
771 };
772
773 Builder.prototype.ready = function(callback) {
774 if (this.closed === true) {
775 return typeof callback === "function" ? callback() : void 0;
776 }
777 return this.once('end', callback);
778 };
779
780 Builder.prototype.query = function(type, tag, key) {
781 if (type === 'attr') {
782 return tag.attrs[key];
783 } else if (type === 'text') {
784 return tag.content;
785 } else if (type === 'tag') {
786 return key;
787 }
788 };
789
790 Builder.prototype.register = function(type, checker) {
791 var _base, _ref2;
792 if (!(type === 'new' || type === 'end' || type === 'ready')) {
793 throw new Error("only type 'ready', 'new' or 'end' allowed.");
794 }
795 if ((_ref2 = (_base = this.checkers)[type]) == null) _base[type] = [];
796 return this.checkers[type].push(checker);
797 };
798
799 Builder.prototype.approve = function(type, parent, tag, callback) {
800 var checkers, next, _ref2, _ref3, _ref4;
801 checkers = (_ref2 = (_ref3 = this.checkers[type]) != null ? typeof _ref3.slice === "function" ? _ref3.slice() : void 0 : void 0) != null ? _ref2 : [];
802 switch (type) {
803 case 'new':
804 next = function(tag) {
805 var checker, _ref4;
806 checker = (_ref4 = checkers.shift()) != null ? _ref4 : callback;
807 return checker(parent, tag, next);
808 };
809 break;
810 case 'ready':
811 case 'end':
812 _ref4 = [tag, parent], callback = _ref4[0], tag = _ref4[1];
813 next = function(tag) {
814 var checker, _ref5;
815 checker = (_ref5 = checkers.shift()) != null ? _ref5 : callback;
816 return checker(tag, next);
817 };
818 break;
819 default:
820 throw new Error("type '" + type + "' not supported.");
821 }
822 return next(tag);
823 };
824
825 return Builder;
826
827 })();
828
829 module.exports = {
830 Tag: Tag,
831 Builder: Builder
832 };
833
834}).call(this);
835
836});
837
838require.define("events", function (require, module, exports, __dirname, __filename) {
839 if (!process.EventEmitter) process.EventEmitter = function () {};
840
841var EventEmitter = exports.EventEmitter = process.EventEmitter;
842var isArray = typeof Array.isArray === 'function'
843 ? Array.isArray
844 : function (xs) {
845 return Object.toString.call(xs) === '[object Array]'
846 }
847;
848
849// By default EventEmitters will print a warning if more than
850// 10 listeners are added to it. This is a useful default which
851// helps finding memory leaks.
852//
853// Obviously not all Emitters should be limited to 10. This function allows
854// that to be increased. Set to zero for unlimited.
855var defaultMaxListeners = 10;
856EventEmitter.prototype.setMaxListeners = function(n) {
857 if (!this._events) this._events = {};
858 this._events.maxListeners = n;
859};
860
861
862EventEmitter.prototype.emit = function(type) {
863 // If there is no 'error' event listener then throw.
864 if (type === 'error') {
865 if (!this._events || !this._events.error ||
866 (isArray(this._events.error) && !this._events.error.length))
867 {
868 if (arguments[1] instanceof Error) {
869 throw arguments[1]; // Unhandled 'error' event
870 } else {
871 throw new Error("Uncaught, unspecified 'error' event.");
872 }
873 return false;
874 }
875 }
876
877 if (!this._events) return false;
878 var handler = this._events[type];
879 if (!handler) return false;
880
881 if (typeof handler == 'function') {
882 switch (arguments.length) {
883 // fast cases
884 case 1:
885 handler.call(this);
886 break;
887 case 2:
888 handler.call(this, arguments[1]);
889 break;
890 case 3:
891 handler.call(this, arguments[1], arguments[2]);
892 break;
893 // slower
894 default:
895 var args = Array.prototype.slice.call(arguments, 1);
896 handler.apply(this, args);
897 }
898 return true;
899
900 } else if (isArray(handler)) {
901 var args = Array.prototype.slice.call(arguments, 1);
902
903 var listeners = handler.slice();
904 for (var i = 0, l = listeners.length; i < l; i++) {
905 listeners[i].apply(this, args);
906 }
907 return true;
908
909 } else {
910 return false;
911 }
912};
913
914// EventEmitter is defined in src/node_events.cc
915// EventEmitter.prototype.emit() is also defined there.
916EventEmitter.prototype.addListener = function(type, listener) {
917 if ('function' !== typeof listener) {
918 throw new Error('addListener only takes instances of Function');
919 }
920
921 if (!this._events) this._events = {};
922
923 // To avoid recursion in the case that type == "newListeners"! Before
924 // adding it to the listeners, first emit "newListeners".
925 this.emit('newListener', type, listener);
926
927 if (!this._events[type]) {
928 // Optimize the case of one listener. Don't need the extra array object.
929 this._events[type] = listener;
930 } else if (isArray(this._events[type])) {
931
932 // Check for listener leak
933 if (!this._events[type].warned) {
934 var m;
935 if (this._events.maxListeners !== undefined) {
936 m = this._events.maxListeners;
937 } else {
938 m = defaultMaxListeners;
939 }
940
941 if (m && m > 0 && this._events[type].length > m) {
942 this._events[type].warned = true;
943 console.error('(node) warning: possible EventEmitter memory ' +
944 'leak detected. %d listeners added. ' +
945 'Use emitter.setMaxListeners() to increase limit.',
946 this._events[type].length);
947 console.trace();
948 }
949 }
950
951 // If we've already got an array, just append.
952 this._events[type].push(listener);
953 } else {
954 // Adding the second element, need to change to array.
955 this._events[type] = [this._events[type], listener];
956 }
957
958 return this;
959};
960
961EventEmitter.prototype.on = EventEmitter.prototype.addListener;
962
963EventEmitter.prototype.once = function(type, listener) {
964 var self = this;
965 self.on(type, function g() {
966 self.removeListener(type, g);
967 listener.apply(this, arguments);
968 });
969
970 return this;
971};
972
973EventEmitter.prototype.removeListener = function(type, listener) {
974 if ('function' !== typeof listener) {
975 throw new Error('removeListener only takes instances of Function');
976 }
977
978 // does not use listeners(), so no side effect of creating _events[type]
979 if (!this._events || !this._events[type]) return this;
980
981 var list = this._events[type];
982
983 if (isArray(list)) {
984 var i = list.indexOf(listener);
985 if (i < 0) return this;
986 list.splice(i, 1);
987 if (list.length == 0)
988 delete this._events[type];
989 } else if (this._events[type] === listener) {
990 delete this._events[type];
991 }
992
993 return this;
994};
995
996EventEmitter.prototype.removeAllListeners = function(type) {
997 // does not use listeners(), so no side effect of creating _events[type]
998 if (type && this._events && this._events[type]) this._events[type] = null;
999 return this;
1000};
1001
1002EventEmitter.prototype.listeners = function(type) {
1003 if (!this._events) this._events = {};
1004 if (!this._events[type]) this._events[type] = [];
1005 if (!isArray(this._events[type])) {
1006 this._events[type] = [this._events[type]];
1007 }
1008 return this._events[type];
1009};
1010
1011});
1012
1013require.define("/node_modules/asyncxml/lib/util.js", function (require, module, exports, __dirname, __filename) {
1014 (function() {
1015 var breakline, deep_merge, indent, isArray, new_attrs, prettify, safe;
1016 var __slice = Array.prototype.slice;
1017
1018 isArray = Array.isArray;
1019
1020 deep_merge = function() {
1021 var k, obj, objs, res, v, _i, _len;
1022 objs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
1023 if (isArray(objs[0])) objs = objs[0];
1024 res = {};
1025 for (_i = 0, _len = objs.length; _i < _len; _i++) {
1026 obj = objs[_i];
1027 for (k in obj) {
1028 v = obj[k];
1029 if (typeof v === 'object' && !isArray(v)) {
1030 res[k] = deep_merge(res[k] || {}, v);
1031 } else {
1032 res[k] = v;
1033 }
1034 }
1035 }
1036 return res;
1037 };
1038
1039 indent = function(_arg) {
1040 var level, pretty;
1041 level = _arg.level, pretty = _arg.pretty;
1042 if (!pretty || level === 0) return "";
1043 if (pretty === true) pretty = " ";
1044 return pretty;
1045 };
1046
1047 breakline = function(_arg, data) {
1048 var level, pretty;
1049 level = _arg.level, pretty = _arg.pretty;
1050 if (!pretty) return data;
1051 if ((data != null ? data[(data != null ? data.length : void 0) - 1] : void 0) === "\n") {
1052 return data;
1053 } else {
1054 return "" + data + "\n";
1055 }
1056 };
1057
1058 prettify = function(el, data) {
1059 if (!(el != null ? el.pretty : void 0)) {
1060 return data;
1061 } else {
1062 return "" + (indent(el)) + (breakline(el, data));
1063 }
1064 };
1065
1066 new_attrs = function(attrs) {
1067 var k, strattrs, v;
1068 if (attrs == null) attrs = {};
1069 strattrs = (function() {
1070 var _results;
1071 _results = [];
1072 for (k in attrs) {
1073 v = attrs[k];
1074 if (v != null) {
1075 if (typeof v !== 'number') v = "\"" + v + "\"";
1076 _results.push("" + k + "=" + v);
1077 } else {
1078 _results.push("" + k);
1079 }
1080 }
1081 return _results;
1082 })();
1083 if (strattrs.length) strattrs.unshift('');
1084 return strattrs.join(' ');
1085 };
1086
1087 safe = function(text) {
1088 return String(text).replace(/&(?!\w+;)/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
1089 };
1090
1091 module.exports = {
1092 deep_merge: deep_merge,
1093 prettify: prettify,
1094 indent: indent,
1095 new_attrs: new_attrs,
1096 safe: safe
1097 };
1098
1099}).call(this);
1100
1101});
1102
1103require.define("/template.js", function (require, module, exports, __dirname, __filename) {
1104 (function() {
1105 var DefaultBuilder, EVENTS, EventEmitter, Template, aliases, doctype, ff, pp, schema, self_closing, _ref;
1106 var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }, __slice = Array.prototype.slice;
1107
1108 EventEmitter = require('events').EventEmitter;
1109
1110 DefaultBuilder = require('asyncxml').Builder;
1111
1112 _ref = require('./schema'), schema = _ref.schema, self_closing = _ref.self_closing;
1113
1114 doctype = require('./doctype').doctype;
1115
1116 aliases = require('./alias').aliases;
1117
1118 EVENTS = ['new', 'add', 'show', 'hide', 'attr', 'text', 'raw', 'remove', 'replace', 'data', 'close', 'end'];
1119
1120 pp = function(proto, name) {
1121 proto[name] = function() {
1122 var _ref2;
1123 return this.tag.apply(this, (_ref2 = [name]).concat.apply(_ref2, arguments));
1124 };
1125 return proto["$" + name] = function() {
1126 var _ref2;
1127 return this.$tag.apply(this, (_ref2 = [name]).concat.apply(_ref2, arguments));
1128 };
1129 };
1130
1131 ff = function(proto, tags) {
1132 var tagname, _i, _len;
1133 for (_i = 0, _len = tags.length; _i < _len; _i++) {
1134 tagname = tags[_i];
1135 if (tagname) pp(proto, tagname);
1136 }
1137 };
1138
1139 Template = (function() {
1140
1141 __extends(Template, EventEmitter);
1142
1143 function Template(opts, template) {
1144 var Builder, ExtendedBuilder, ExtendedTag, Tag, old_query, s, schema_input, _ref2, _ref3, _ref4, _ref5, _ref6;
1145 var _this = this;
1146 if (opts == null) opts = {};
1147 this.ready = __bind(this.ready, this);
1148 this.end = __bind(this.end, this);
1149 this.register = __bind(this.register, this);
1150 if (typeof opts === 'function') {
1151 _ref2 = [opts, {}], template = _ref2[0], opts = _ref2[1];
1152 }
1153 if ((_ref3 = opts.encoding) == null) opts.encoding = 'utf-8';
1154 if ((_ref4 = opts.doctype) == null) opts.doctype = false;
1155 if ((_ref5 = opts.end) == null) opts.end = true;
1156 schema_input = opts.schema;
1157 s = aliases[schema_input] || schema_input || 'xml';
1158 opts.self_closing = typeof self_closing[s] === "function" ? self_closing[s](opts) : void 0;
1159 opts.schema = typeof schema[s] === "function" ? schema[s](opts).split(' ') : void 0;
1160 Builder = (_ref6 = opts.Builder) != null ? _ref6 : DefaultBuilder;
1161 ExtendedBuilder = (function() {
1162
1163 __extends(ExtendedBuilder, Builder);
1164
1165 function ExtendedBuilder() {
1166 ExtendedBuilder.__super__.constructor.apply(this, arguments);
1167 }
1168
1169 return ExtendedBuilder;
1170
1171 })();
1172 ff(ExtendedBuilder.prototype, opts.schema);
1173 this.xml = new ExtendedBuilder(opts);
1174 this.xml.template = this;
1175 old_query = this.xml.query;
1176 this.xml.query = function(type, tag, key) {
1177 var _ref7;
1178 if (type === 'tag') {
1179 return (_ref7 = key.xml) != null ? _ref7 : key;
1180 } else {
1181 return old_query.call(this, type, tag, key);
1182 }
1183 };
1184 Tag = this.xml.Tag;
1185 ExtendedTag = (function() {
1186
1187 __extends(ExtendedTag, Tag);
1188
1189 function ExtendedTag() {
1190 ExtendedTag.__super__.constructor.apply(this, arguments);
1191 }
1192
1193 return ExtendedTag;
1194
1195 })();
1196 ff(ExtendedTag.prototype, opts.schema);
1197 this.xml.Tag = this.xml.opts.Tag = ExtendedTag;
1198 this.xml.register('end', function(tag, next) {
1199 if (!(opts.self_closing === true || opts.self_closing.match(tag.name))) {
1200 tag.isempty = false;
1201 }
1202 return next(tag);
1203 });
1204 EVENTS.forEach(function(event) {
1205 return _this.xml.on(event, function() {
1206 var args;
1207 args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
1208 return _this.emit.apply(_this, [event].concat(__slice.call(args)));
1209 });
1210 });
1211 process.nextTick(function() {
1212 var d, dt, _ref7, _ref8;
1213 if (opts.doctype === true) opts.doctype = 'html';
1214 d = aliases[opts.doctype] || opts.doctype;
1215 if (opts.doctype && (dt = typeof doctype[d] === "function" ? doctype[d](opts) : void 0)) {
1216 if (opts.pretty) dt += "\n";
1217 _this.xml.emit('data', _this.xml, dt);
1218 }
1219 if (typeof template === 'function') {
1220 if ((_ref7 = _this.xml) != null ? _ref7._debug : void 0) {
1221 console.error("RUN", _this.xml._view.cid);
1222 }
1223 template.call(_this.xml);
1224 if (opts.end) return _this.end();
1225 } else {
1226 if ((_ref8 = _this.xml) != null ? _ref8._debug : void 0) {
1227 console.error("PASS", _this.xml._view.cid);
1228 }
1229 return _this.end(template);
1230 }
1231 });
1232 }
1233
1234 Template.prototype.toString = function() {
1235 return "[object Template]";
1236 };
1237
1238 Template.prototype.register = function() {
1239 var _ref2;
1240 return (_ref2 = this.xml).register.apply(_ref2, arguments);
1241 };
1242
1243 Template.prototype.end = function() {
1244 var _ref2;
1245 return (_ref2 = this.xml).end.apply(_ref2, arguments);
1246 };
1247
1248 Template.prototype.ready = function() {
1249 var _ref2;
1250 return (_ref2 = this.xml).ready.apply(_ref2, arguments);
1251 };
1252
1253 return Template;
1254
1255 })();
1256
1257 Template.schema = schema;
1258
1259 Template.doctype = doctype;
1260
1261 Template.self_closing = self_closing;
1262
1263 Template.aliases = aliases;
1264
1265 module.exports = Template;
1266
1267}).call(this);
1268
1269});
1270
1271require.define("/schema.js", function (require, module, exports, __dirname, __filename) {
1272 (function() {
1273 var schema, self_closing;
1274
1275 schema = {
1276 'xml': function() {
1277 return "";
1278 },
1279 'html': function() {
1280 return ("" + (schema.xml()) + " " + (schema['html-obsolete']()) + " iframe label legend ") + ("" + (self_closing.html()) + " html body div ul li a b body button colgroup ") + "dfn div dl dt em dd del form h1 h2 h3 h4 h5 h6 head hgroup html ins " + "li map i mark menu meter nav noscript object ol optgroup option p " + "pre script select small span strong style sub sup table tbody tfoot " + "td textarea th thead title tr u ul";
1281 },
1282 'html5': function() {
1283 return ("" + (schema.html()) + " " + (self_closing.html5()) + " section article video q s ") + "audio abbr address aside bdi bdo blockquote canvas caption cite code " + "datalist details fieldset figcaption figure footer header kbd output " + "progress rp rt ruby samp summary time";
1284 },
1285 'strict': function() {
1286 return "" + (schema.html());
1287 },
1288 'xhtml': function() {
1289 return "" + (schema.html());
1290 },
1291 'xhtml1.1': function() {
1292 return "" + (schema.xhtml());
1293 },
1294 'frameset': function() {
1295 return "" + (schema.xhtml());
1296 },
1297 'transitional': function() {
1298 return "" + (schema.xhtml());
1299 },
1300 'mobile': function() {
1301 return "" + (schema.xhtml());
1302 },
1303 'html-ce': function() {
1304 return "" + (schema.xhtml());
1305 },
1306 'html-obsolete': function() {
1307 return "applet acronym bgsound dir frameset noframes isindex listing nextid " + "noembed plaintext rb strike xmp big blink center font marquee nobr " + "multicol spacer tt";
1308 },
1309 "svg1.1": function() {
1310 return "altGlyph altGlyphDef altGlyphItem animate animateColor animateMotion" + "a animateTransform circle clipPath color-profile cursor defs desc" + "ellipse feBlend feColorMatrix feComponentTransfer feComposite" + "feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight" + "feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage" + "feMerge feMergeNode feMorphology feOffset fePointLight feSpotLight" + "feSpecularLighting feTile feTurbulence linearGradient polyline" + "filter font font-face font-face-format font-face-name font-face-src" + "font-face-uri foreignObject g glyph glyphRef hkern image line" + "marker mask metadata missing-glyph mpath path pattern polygon" + "radialGradient rect script set stop style svg switch symbol text" + "textPath title tref tspan use view vkern";
1311 }
1312 };
1313
1314 self_closing = {
1315 'xml': function() {
1316 return true;
1317 },
1318 'svg1.1': function() {
1319 return true;
1320 },
1321 'html': function() {
1322 return "area br col embed hr img input link meta param";
1323 },
1324 'html5': function() {
1325 return "" + (self_closing.html()) + " base command keygen source track wbr";
1326 },
1327 'mobile': function() {
1328 return "" + (self_closing.xhtml());
1329 },
1330 'html-ce': function() {
1331 return "" + (self_closing.xhtml());
1332 },
1333 'strict': function() {
1334 return "" + (self_closing.xhtml());
1335 },
1336 'xhtml1.1': function() {
1337 return "" + (self_closing.xhtml());
1338 },
1339 'xhtml': function() {
1340 return "" + (self_closing.html());
1341 },
1342 'frameset': function() {
1343 return "" + (self_closing.xhtml());
1344 },
1345 'transitional': function() {
1346 return "" + (self_closing.xhtml());
1347 }
1348 };
1349
1350 module.exports = {
1351 self_closing: self_closing,
1352 schema: schema
1353 };
1354
1355}).call(this);
1356
1357});
1358
1359require.define("/doctype.js", function (require, module, exports, __dirname, __filename) {
1360 (function() {
1361 var doctype;
1362
1363 doctype = {
1364 'xml': function(_arg) {
1365 var encoding;
1366 encoding = _arg.encoding;
1367 return "<?xml version=\"1.0\" encoding=\"" + encoding + "\" ?>";
1368 },
1369 'html': function() {
1370 return "<!DOCTYPE html>";
1371 },
1372 'html5': function() {
1373 return "" + (doctype.html());
1374 },
1375 'mobile': function() {
1376 return '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD ' + 'XHTML Mobile 1.2//EN" ' + '"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">';
1377 },
1378 'html-ce': function() {
1379 return '<!DOCTYPE html PUBLIC ' + '"-//W3C//DTD XHTML 1.0 Transitional//EN" ' + '"ce-html-1.0-transitional.dtd">';
1380 },
1381 'strict': function() {
1382 return '<!DOCTYPE html PUBLIC ' + '"-//W3C//DTD XHTML 1.0 Strict//EN" ' + '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
1383 },
1384 'xhtml1.1': function() {
1385 return '<!DOCTYPE html PUBLIC ' + '"-//W3C//DTD XHTML 1.1//EN" ' + '"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
1386 },
1387 'xhtml': function() {
1388 return '<!DOCTYPE html PUBLIC ' + '"-//W3C//DTD XHTML Basic 1.1//EN" ' + '"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">';
1389 },
1390 'frameset': function() {
1391 return '<!DOCTYPE html PUBLIC ' + '"-//W3C//DTD XHTML 1.0 Frameset//EN" ' + '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
1392 },
1393 'transitional': function() {
1394 return '<!DOCTYPE html PUBLIC ' + '"-//W3C//DTD XHTML 1.0 Transitional//EN" ' + '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
1395 }
1396 };
1397
1398 module.exports = {
1399 doctype: doctype
1400 };
1401
1402}).call(this);
1403
1404});
1405
1406require.define("/alias.js", function (require, module, exports, __dirname, __filename) {
1407 (function() {
1408 var aliases;
1409
1410 aliases = {
1411 'default': 'xml',
1412 '5': 'html5',
1413 5: 'html5',
1414 'ce': 'html-ce',
1415 '1.1': 'xhtml1.1',
1416 'html11': 'xhtml1.1',
1417 'basic': 'xhtml',
1418 'xhtml1': 'xhtml',
1419 'xhtml-basic': 'xhtml',
1420 'xhtml-strict': 'strict',
1421 'xhtml-mobile': 'mobile',
1422 'xhtml-frameset': 'frameset',
1423 'xhtml-trasitional': 'transitional',
1424 'svg': 'svg1.1'
1425 };
1426
1427 module.exports = {
1428 aliases: aliases
1429 };
1430
1431}).call(this);
1432
1433});
1434;require('./dynamictemplate');}).call(this);
\No newline at end of file