Commit 637ff54e authored by Stephen Sawchuk's avatar Stephen Sawchuk

serenade updated to use bower.

parent dd83a536
{
"name": "todomvc-serenadejs",
"version": "0.0.0",
"dependencies": {
"director": "~1.2.0",
"todomvc-common": "~0.1.2"
}
}
//
// Generated on Sun Dec 16 2012 22:47:05 GMT-0500 (EST) by Nodejitsu, Inc (Using Codesurgeon).
// Version 1.1.9
//
(function (exports) {
/*
* browser.js: Browser specific functionality for director.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
if (!Array.prototype.filter) {
Array.prototype.filter = function(filter, that) {
var other = [], v;
for (var i = 0, n = this.length; i < n; i++) {
if (i in this && filter.call(that, v = this[i], i, this)) {
other.push(v);
}
}
return other;
};
}
if (!Array.isArray){
Array.isArray = function(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
};
}
var dloc = document.location;
function dlocHashEmpty() {
// Non-IE browsers return '' when the address bar shows '#'; Director's logic
// assumes both mean empty.
return dloc.hash === '' || dloc.hash === '#';
}
var listener = {
mode: 'modern',
hash: dloc.hash,
history: false,
check: function () {
var h = dloc.hash;
if (h != this.hash) {
this.hash = h;
this.onHashChanged();
}
},
fire: function () {
if (this.mode === 'modern') {
this.history === true ? window.onpopstate() : window.onhashchange();
}
else {
this.onHashChanged();
}
},
init: function (fn, history) {
var self = this;
this.history = history;
if (!Router.listeners) {
Router.listeners = [];
}
function onchange(onChangeEvent) {
for (var i = 0, l = Router.listeners.length; i < l; i++) {
Router.listeners[i](onChangeEvent);
}
}
//note IE8 is being counted as 'modern' because it has the hashchange event
if ('onhashchange' in window && (document.documentMode === undefined
|| document.documentMode > 7)) {
// At least for now HTML5 history is available for 'modern' browsers only
if (this.history === true) {
// There is an old bug in Chrome that causes onpopstate to fire even
// upon initial page load. Since the handler is run manually in init(),
// this would cause Chrome to run it twise. Currently the only
// workaround seems to be to set the handler after the initial page load
// http://code.google.com/p/chromium/issues/detail?id=63040
setTimeout(function() {
window.onpopstate = onchange;
}, 500);
}
else {
window.onhashchange = onchange;
}
this.mode = 'modern';
}
else {
//
// IE support, based on a concept by Erik Arvidson ...
//
var frame = document.createElement('iframe');
frame.id = 'state-frame';
frame.style.display = 'none';
document.body.appendChild(frame);
this.writeFrame('');
if ('onpropertychange' in document && 'attachEvent' in document) {
document.attachEvent('onpropertychange', function () {
if (event.propertyName === 'location') {
self.check();
}
});
}
window.setInterval(function () { self.check(); }, 50);
this.onHashChanged = onchange;
this.mode = 'legacy';
}
Router.listeners.push(fn);
return this.mode;
},
destroy: function (fn) {
if (!Router || !Router.listeners) {
return;
}
var listeners = Router.listeners;
for (var i = listeners.length - 1; i >= 0; i--) {
if (listeners[i] === fn) {
listeners.splice(i, 1);
}
}
},
setHash: function (s) {
// Mozilla always adds an entry to the history
if (this.mode === 'legacy') {
this.writeFrame(s);
}
if (this.history === true) {
window.history.pushState({}, document.title, s);
// Fire an onpopstate event manually since pushing does not obviously
// trigger the pop event.
this.fire();
} else {
dloc.hash = (s[0] === '/') ? s : '/' + s;
}
return this;
},
writeFrame: function (s) {
// IE support...
var f = document.getElementById('state-frame');
var d = f.contentDocument || f.contentWindow.document;
d.open();
d.write("<script>_hash = '" + s + "'; onload = parent.listener.syncHash;<script>");
d.close();
},
syncHash: function () {
// IE support...
var s = this._hash;
if (s != dloc.hash) {
dloc.hash = s;
}
return this;
},
onHashChanged: function () {}
};
var Router = exports.Router = function (routes) {
if (!(this instanceof Router)) return new Router(routes);
this.params = {};
this.routes = {};
this.methods = ['on', 'once', 'after', 'before'];
this.scope = [];
this._methods = {};
this._insert = this.insert;
this.insert = this.insertEx;
this.historySupport = (window.history != null ? window.history.pushState : null) != null
this.configure();
this.mount(routes || {});
};
Router.prototype.init = function (r) {
var self = this;
this.handler = function(onChangeEvent) {
var newURL = onChangeEvent && onChangeEvent.newURL || window.location.hash;
var url = self.history === true ? self.getPath() : newURL.replace(/.*#/, '');
self.dispatch('on', url);
};
listener.init(this.handler, this.history);
if (this.history === false) {
if (dlocHashEmpty() && r) {
dloc.hash = r;
} else if (!dlocHashEmpty()) {
self.dispatch('on', dloc.hash.replace(/^#/, ''));
}
}
else {
var routeTo = dlocHashEmpty() && r ? r : !dlocHashEmpty() ? dloc.hash.replace(/^#/, '') : null;
if (routeTo) {
window.history.replaceState({}, document.title, routeTo);
}
// Router has been initialized, but due to the chrome bug it will not
// yet actually route HTML5 history state changes. Thus, decide if should route.
if (routeTo || this.run_in_init === true) {
this.handler();
}
}
return this;
};
Router.prototype.explode = function () {
var v = this.history === true ? this.getPath() : dloc.hash;
if (v.charAt(1) === '/') { v=v.slice(1) }
return v.slice(1, v.length).split("/");
};
Router.prototype.setRoute = function (i, v, val) {
var url = this.explode();
if (typeof i === 'number' && typeof v === 'string') {
url[i] = v;
}
else if (typeof val === 'string') {
url.splice(i, v, s);
}
else {
url = [i];
}
listener.setHash(url.join('/'));
return url;
};
//
// ### function insertEx(method, path, route, parent)
// #### @method {string} Method to insert the specific `route`.
// #### @path {Array} Parsed path to insert the `route` at.
// #### @route {Array|function} Route handlers to insert.
// #### @parent {Object} **Optional** Parent "routes" to insert into.
// insert a callback that will only occur once per the matched route.
//
Router.prototype.insertEx = function(method, path, route, parent) {
if (method === "once") {
method = "on";
route = function(route) {
var once = false;
return function() {
if (once) return;
once = true;
return route.apply(this, arguments);
};
}(route);
}
return this._insert(method, path, route, parent);
};
Router.prototype.getRoute = function (v) {
var ret = v;
if (typeof v === "number") {
ret = this.explode()[v];
}
else if (typeof v === "string"){
var h = this.explode();
ret = h.indexOf(v);
}
else {
ret = this.explode();
}
return ret;
};
Router.prototype.destroy = function () {
listener.destroy(this.handler);
return this;
};
Router.prototype.getPath = function () {
var path = window.location.pathname;
if (path.substr(0, 1) !== '/') {
path = '/' + path;
}
return path;
};
function _every(arr, iterator) {
for (var i = 0; i < arr.length; i += 1) {
if (iterator(arr[i], i, arr) === false) {
return;
}
}
}
function _flatten(arr) {
var flat = [];
for (var i = 0, n = arr.length; i < n; i++) {
flat = flat.concat(arr[i]);
}
return flat;
}
function _asyncEverySeries(arr, iterator, callback) {
if (!arr.length) {
return callback();
}
var completed = 0;
(function iterate() {
iterator(arr[completed], function(err) {
if (err || err === false) {
callback(err);
callback = function() {};
} else {
completed += 1;
if (completed === arr.length) {
callback();
} else {
iterate();
}
}
});
})();
}
function paramifyString(str, params, mod) {
mod = str;
for (var param in params) {
if (params.hasOwnProperty(param)) {
mod = params[param](str);
if (mod !== str) {
break;
}
}
}
return mod === str ? "([._a-zA-Z0-9-]+)" : mod;
}
function regifyString(str, params) {
var matches, last = 0, out = "";
while (matches = str.substr(last).match(/[^\w\d\- %@&]*\*[^\w\d\- %@&]*/)) {
last = matches.index + matches[0].length;
matches[0] = matches[0].replace(/^\*/, "([_.()!\\ %@&a-zA-Z0-9-]+)");
out += str.substr(0, matches.index) + matches[0];
}
str = out += str.substr(last);
var captures = str.match(/:([^\/]+)/ig), length;
if (captures) {
length = captures.length;
for (var i = 0; i < length; i++) {
str = str.replace(captures[i], paramifyString(captures[i], params));
}
}
return str;
}
function terminator(routes, delimiter, start, stop) {
var last = 0, left = 0, right = 0, start = (start || "(").toString(), stop = (stop || ")").toString(), i;
for (i = 0; i < routes.length; i++) {
var chunk = routes[i];
if (chunk.indexOf(start, last) > chunk.indexOf(stop, last) || ~chunk.indexOf(start, last) && !~chunk.indexOf(stop, last) || !~chunk.indexOf(start, last) && ~chunk.indexOf(stop, last)) {
left = chunk.indexOf(start, last);
right = chunk.indexOf(stop, last);
if (~left && !~right || !~left && ~right) {
var tmp = routes.slice(0, (i || 1) + 1).join(delimiter);
routes = [ tmp ].concat(routes.slice((i || 1) + 1));
}
last = (right > left ? right : left) + 1;
i = 0;
} else {
last = 0;
}
}
return routes;
}
Router.prototype.configure = function(options) {
options = options || {};
for (var i = 0; i < this.methods.length; i++) {
this._methods[this.methods[i]] = true;
}
this.recurse = options.recurse || this.recurse || false;
this.async = options.async || false;
this.delimiter = options.delimiter || "/";
this.strict = typeof options.strict === "undefined" ? true : options.strict;
this.notfound = options.notfound;
this.resource = options.resource;
this.history = options.html5history && this.historySupport || false;
this.run_in_init = this.history === true && options.run_handler_in_init !== false;
this.every = {
after: options.after || null,
before: options.before || null,
on: options.on || null
};
return this;
};
Router.prototype.param = function(token, matcher) {
if (token[0] !== ":") {
token = ":" + token;
}
var compiled = new RegExp(token, "g");
this.params[token] = function(str) {
return str.replace(compiled, matcher.source || matcher);
};
};
Router.prototype.on = Router.prototype.route = function(method, path, route) {
var self = this;
if (!route && typeof path == "function") {
route = path;
path = method;
method = "on";
}
if (Array.isArray(path)) {
return path.forEach(function(p) {
self.on(method, p, route);
});
}
if (path.source) {
path = path.source.replace(/\\\//ig, "/");
}
if (Array.isArray(method)) {
return method.forEach(function(m) {
self.on(m.toLowerCase(), path, route);
});
}
path = path.split(new RegExp(this.delimiter));
path = terminator(path, this.delimiter);
this.insert(method, this.scope.concat(path), route);
};
Router.prototype.dispatch = function(method, path, callback) {
var self = this, fns = this.traverse(method, path, this.routes, ""), invoked = this._invoked, after;
this._invoked = true;
if (!fns || fns.length === 0) {
this.last = [];
if (typeof this.notfound === "function") {
this.invoke([ this.notfound ], {
method: method,
path: path
}, callback);
}
return false;
}
if (this.recurse === "forward") {
fns = fns.reverse();
}
function updateAndInvoke() {
self.last = fns.after;
self.invoke(self.runlist(fns), self, callback);
}
after = this.every && this.every.after ? [ this.every.after ].concat(this.last) : [ this.last ];
if (after && after.length > 0 && invoked) {
if (this.async) {
this.invoke(after, this, updateAndInvoke);
} else {
this.invoke(after, this);
updateAndInvoke();
}
return true;
}
updateAndInvoke();
return true;
};
Router.prototype.invoke = function(fns, thisArg, callback) {
var self = this;
if (this.async) {
_asyncEverySeries(fns, function apply(fn, next) {
if (Array.isArray(fn)) {
return _asyncEverySeries(fn, apply, next);
} else if (typeof fn == "function") {
fn.apply(thisArg, fns.captures.concat(next));
}
}, function() {
if (callback) {
callback.apply(thisArg, arguments);
}
});
} else {
_every(fns, function apply(fn) {
if (Array.isArray(fn)) {
return _every(fn, apply);
} else if (typeof fn === "function") {
return fn.apply(thisArg, fns.captures || []);
} else if (typeof fn === "string" && self.resource) {
self.resource[fn].apply(thisArg, fns.captures || []);
}
});
}
};
Router.prototype.traverse = function(method, path, routes, regexp, filter) {
var fns = [], current, exact, match, next, that;
function filterRoutes(routes) {
if (!filter) {
return routes;
}
function deepCopy(source) {
var result = [];
for (var i = 0; i < source.length; i++) {
result[i] = Array.isArray(source[i]) ? deepCopy(source[i]) : source[i];
}
return result;
}
function applyFilter(fns) {
for (var i = fns.length - 1; i >= 0; i--) {
if (Array.isArray(fns[i])) {
applyFilter(fns[i]);
if (fns[i].length === 0) {
fns.splice(i, 1);
}
} else {
if (!filter(fns[i])) {
fns.splice(i, 1);
}
}
}
}
var newRoutes = deepCopy(routes);
newRoutes.matched = routes.matched;
newRoutes.captures = routes.captures;
newRoutes.after = routes.after.filter(filter);
applyFilter(newRoutes);
return newRoutes;
}
if (path === this.delimiter && routes[method]) {
next = [ [ routes.before, routes[method] ].filter(Boolean) ];
next.after = [ routes.after ].filter(Boolean);
next.matched = true;
next.captures = [];
return filterRoutes(next);
}
for (var r in routes) {
if (routes.hasOwnProperty(r) && (!this._methods[r] || this._methods[r] && typeof routes[r] === "object" && !Array.isArray(routes[r]))) {
current = exact = regexp + this.delimiter + r;
if (!this.strict) {
exact += "[" + this.delimiter + "]?";
}
match = path.match(new RegExp("^" + exact));
if (!match) {
continue;
}
if (match[0] && match[0] == path && routes[r][method]) {
next = [ [ routes[r].before, routes[r][method] ].filter(Boolean) ];
next.after = [ routes[r].after ].filter(Boolean);
next.matched = true;
next.captures = match.slice(1);
if (this.recurse && routes === this.routes) {
next.push([ routes.before, routes.on ].filter(Boolean));
next.after = next.after.concat([ routes.after ].filter(Boolean));
}
return filterRoutes(next);
}
next = this.traverse(method, path, routes[r], current);
if (next.matched) {
if (next.length > 0) {
fns = fns.concat(next);
}
if (this.recurse) {
fns.push([ routes[r].before, routes[r].on ].filter(Boolean));
next.after = next.after.concat([ routes[r].after ].filter(Boolean));
if (routes === this.routes) {
fns.push([ routes["before"], routes["on"] ].filter(Boolean));
next.after = next.after.concat([ routes["after"] ].filter(Boolean));
}
}
fns.matched = true;
fns.captures = next.captures;
fns.after = next.after;
return filterRoutes(fns);
}
}
}
return false;
};
Router.prototype.insert = function(method, path, route, parent) {
var methodType, parentType, isArray, nested, part;
path = path.filter(function(p) {
return p && p.length > 0;
});
parent = parent || this.routes;
part = path.shift();
if (/\:|\*/.test(part) && !/\\d|\\w/.test(part)) {
part = regifyString(part, this.params);
}
if (path.length > 0) {
parent[part] = parent[part] || {};
return this.insert(method, path, route, parent[part]);
}
if (!part && !path.length && parent === this.routes) {
methodType = typeof parent[method];
switch (methodType) {
case "function":
parent[method] = [ parent[method], route ];
return;
case "object":
parent[method].push(route);
return;
case "undefined":
parent[method] = route;
return;
}
return;
}
parentType = typeof parent[part];
isArray = Array.isArray(parent[part]);
if (parent[part] && !isArray && parentType == "object") {
methodType = typeof parent[part][method];
switch (methodType) {
case "function":
parent[part][method] = [ parent[part][method], route ];
return;
case "object":
parent[part][method].push(route);
return;
case "undefined":
parent[part][method] = route;
return;
}
} else if (parentType == "undefined") {
nested = {};
nested[method] = route;
parent[part] = nested;
return;
}
throw new Error("Invalid route context: " + parentType);
};
Router.prototype.extend = function(methods) {
var self = this, len = methods.length, i;
function extend(method) {
self._methods[method] = true;
self[method] = function() {
var extra = arguments.length === 1 ? [ method, "" ] : [ method ];
self.on.apply(self, extra.concat(Array.prototype.slice.call(arguments)));
};
}
for (i = 0; i < len; i++) {
extend(methods[i]);
}
};
Router.prototype.runlist = function(fns) {
var runlist = this.every && this.every.before ? [ this.every.before ].concat(_flatten(fns)) : _flatten(fns);
if (this.every && this.every.on) {
runlist.push(this.every.on);
}
runlist.captures = fns.captures;
runlist.source = fns.source;
return runlist;
};
Router.prototype.mount = function(routes, path) {
if (!routes || typeof routes !== "object" || Array.isArray(routes)) {
return;
}
var self = this;
path = path || [];
if (!Array.isArray(path)) {
path = path.split(self.delimiter);
}
function insertOrMount(route, local) {
var rename = route, parts = route.split(self.delimiter), routeType = typeof routes[route], isRoute = parts[0] === "" || !self._methods[parts[0]], event = isRoute ? "on" : rename;
if (isRoute) {
rename = rename.slice((rename.match(new RegExp(self.delimiter)) || [ "" ])[0].length);
parts.shift();
}
if (isRoute && routeType === "object" && !Array.isArray(routes[route])) {
local = local.concat(parts);
self.mount(routes[route], local);
return;
}
if (isRoute) {
local = local.concat(rename.split(self.delimiter));
local = terminator(local, self.delimiter);
}
self.insert(event, local, routes[route]);
}
for (var route in routes) {
if (routes.hasOwnProperty(route)) {
insertOrMount(route, path.slice(0));
}
}
};
}(typeof exports === "object" ? exports : window));
\ No newline at end of file
html,
body {
margin: 0;
padding: 0;
}
button {
margin: 0;
padding: 0;
border: 0;
background: none;
font-size: 100%;
vertical-align: baseline;
font-family: inherit;
color: inherit;
-webkit-appearance: none;
/*-moz-appearance: none;*/
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
body {
font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.4em;
background: #eaeaea url('bg.png');
color: #4d4d4d;
width: 550px;
margin: 0 auto;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
}
#todoapp {
background: #fff;
background: rgba(255, 255, 255, 0.9);
margin: 130px 0 40px 0;
border: 1px solid #ccc;
position: relative;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),
0 25px 50px 0 rgba(0, 0, 0, 0.15);
}
#todoapp:before {
content: '';
border-left: 1px solid #f5d6d6;
border-right: 1px solid #f5d6d6;
width: 2px;
position: absolute;
top: 0;
left: 40px;
height: 100%;
}
#todoapp input::-webkit-input-placeholder {
font-style: italic;
}
#todoapp input:-moz-placeholder {
font-style: italic;
color: #a9a9a9;
}
#todoapp h1 {
position: absolute;
top: -120px;
width: 100%;
font-size: 70px;
font-weight: bold;
text-align: center;
color: #b3b3b3;
color: rgba(255, 255, 255, 0.3);
text-shadow: -1px -1px rgba(0, 0, 0, 0.2);
-webkit-text-rendering: optimizeLegibility;
-moz-text-rendering: optimizeLegibility;
-ms-text-rendering: optimizeLegibility;
-o-text-rendering: optimizeLegibility;
text-rendering: optimizeLegibility;
}
#header {
padding-top: 15px;
border-radius: inherit;
}
#header:before {
content: '';
position: absolute;
top: 0;
right: 0;
left: 0;
height: 15px;
z-index: 2;
border-bottom: 1px solid #6c615c;
background: #8d7d77;
background: -webkit-gradient(linear, left top, left bottom, from(rgba(132, 110, 100, 0.8)),to(rgba(101, 84, 76, 0.8)));
background: -webkit-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: -moz-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: -o-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: -ms-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670');
border-top-left-radius: 1px;
border-top-right-radius: 1px;
}
#new-todo,
.edit {
position: relative;
margin: 0;
width: 100%;
font-size: 24px;
font-family: inherit;
line-height: 1.4em;
border: 0;
outline: none;
color: inherit;
padding: 6px;
border: 1px solid #999;
box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
}
#new-todo {
padding: 16px 16px 16px 60px;
border: none;
background: rgba(0, 0, 0, 0.02);
z-index: 2;
box-shadow: none;
}
#main {
position: relative;
z-index: 2;
border-top: 1px dotted #adadad;
}
label[for='toggle-all'] {
display: none;
}
#toggle-all {
position: absolute;
top: -42px;
left: -4px;
width: 40px;
text-align: center;
border: none; /* Mobile Safari */
}
#toggle-all:before {
content: '»';
font-size: 28px;
color: #d9d9d9;
padding: 0 25px 7px;
}
#toggle-all:checked:before {
color: #737373;
}
#todo-list {
margin: 0;
padding: 0;
list-style: none;
}
#todo-list li {
position: relative;
font-size: 24px;
border-bottom: 1px dotted #ccc;
}
#todo-list li:last-child {
border-bottom: none;
}
#todo-list li.editing {
border-bottom: none;
padding: 0;
}
#todo-list li.editing .edit {
display: block;
width: 506px;
padding: 13px 17px 12px 17px;
margin: 0 0 0 43px;
}
#todo-list li.editing .view {
display: none;
}
#todo-list li .toggle {
text-align: center;
width: 40px;
/* auto, since non-WebKit browsers doesn't support input styling */
height: auto;
position: absolute;
top: 0;
bottom: 0;
margin: auto 0;
border: none; /* Mobile Safari */
-webkit-appearance: none;
/*-moz-appearance: none;*/
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
#todo-list li .toggle:after {
content: '✔';
line-height: 43px; /* 40 + a couple of pixels visual adjustment */
font-size: 20px;
color: #d9d9d9;
text-shadow: 0 -1px 0 #bfbfbf;
}
#todo-list li .toggle:checked:after {
color: #85ada7;
text-shadow: 0 1px 0 #669991;
bottom: 1px;
position: relative;
}
#todo-list li label {
word-break: break-word;
padding: 15px;
margin-left: 45px;
display: block;
line-height: 1.2;
-webkit-transition: color 0.4s;
-moz-transition: color 0.4s;
-ms-transition: color 0.4s;
-o-transition: color 0.4s;
transition: color 0.4s;
}
#todo-list li.completed label {
color: #a9a9a9;
text-decoration: line-through;
}
#todo-list li .destroy {
display: none;
position: absolute;
top: 0;
right: 10px;
bottom: 0;
width: 40px;
height: 40px;
margin: auto 0;
font-size: 22px;
color: #a88a8a;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
#todo-list li .destroy:hover {
text-shadow: 0 0 1px #000,
0 0 10px rgba(199, 107, 107, 0.8);
-webkit-transform: scale(1.3);
-moz-transform: scale(1.3);
-ms-transform: scale(1.3);
-o-transform: scale(1.3);
transform: scale(1.3);
}
#todo-list li .destroy:after {
content: '✖';
}
#todo-list li:hover .destroy {
display: block;
}
#todo-list li .edit {
display: none;
}
#todo-list li.editing:last-child {
margin-bottom: -1px;
}
#footer {
color: #777;
padding: 0 15px;
position: absolute;
right: 0;
bottom: -31px;
left: 0;
height: 20px;
z-index: 1;
text-align: center;
}
#footer:before {
content: '';
position: absolute;
right: 0;
bottom: 31px;
left: 0;
height: 50px;
z-index: -1;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3),
0 6px 0 -3px rgba(255, 255, 255, 0.8),
0 7px 1px -3px rgba(0, 0, 0, 0.3),
0 43px 0 -6px rgba(255, 255, 255, 0.8),
0 44px 2px -6px rgba(0, 0, 0, 0.2);
}
#todo-count {
float: left;
text-align: left;
}
#filters {
margin: 0;
padding: 0;
list-style: none;
position: absolute;
right: 0;
left: 0;
}
#filters li {
display: inline;
}
#filters li a {
color: #83756f;
margin: 2px;
text-decoration: none;
}
#filters li a.selected {
font-weight: bold;
}
#clear-completed {
float: right;
position: relative;
line-height: 20px;
text-decoration: none;
background: rgba(0, 0, 0, 0.1);
font-size: 11px;
padding: 0 10px;
border-radius: 3px;
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.2);
}
#clear-completed:hover {
background: rgba(0, 0, 0, 0.15);
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.3);
}
#info {
margin: 65px auto 0;
color: #a6a6a6;
font-size: 12px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
text-align: center;
}
#info a {
color: inherit;
}
/*
Hack to remove background from Mobile Safari.
Can't use it globally since it destroys checkboxes in Firefox and Opera
*/
@media screen and (-webkit-min-device-pixel-ratio:0) {
#toggle-all,
#todo-list li .toggle {
background: none;
}
#todo-list li .toggle {
height: 40px;
}
#toggle-all {
top: -56px;
left: -15px;
width: 65px;
height: 41px;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
-webkit-appearance: none;
appearance: none;
}
}
.hidden{
display:none;
}
(function () {
'use strict';
if (location.hostname === 'todomvc.com') {
window._gaq = [['_setAccount','UA-31081062-1'],['_trackPageview']];(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src='//www.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)}(document,'script'));
}
function getSourcePath() {
// If accessed via addyosmani.github.com/todomvc/, strip the project
// path.
if (location.hostname.indexOf('github.com') > 0) {
return location.pathname.replace(/todomvc\//, '');
}
return location.pathname;
}
function appendSourceLink() {
var sourceLink = document.createElement('a');
var paragraph = document.createElement('p');
var footer = document.getElementById('info');
var urlBase = 'https://github.com/addyosmani/todomvc/tree/gh-pages';
if (footer) {
sourceLink.href = urlBase + getSourcePath();
sourceLink.appendChild(document.createTextNode('Check out the source'));
paragraph.appendChild(sourceLink);
footer.appendChild(paragraph);
}
}
function redirect() {
if (location.hostname === 'addyosmani.github.com') {
location.href = location.href.replace('addyosmani.github.com/todomvc',
'todomvc.com');
}
}
appendSourceLink();
redirect();
})();
......@@ -4,65 +4,64 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Serenade.js • TodoMVC</title>
<link href="../../../assets/base.css" rel="stylesheet">
<!--[if IE]>
<script src="../../../assets/ie.js"></script>
<![endif]-->
<script id="app" type="text/serenade">
section#todoapp
header#header
form[event:submit=newTodo!]
h1 "todos"
<link href="components/todomvc-common/base.css" rel="stylesheet">
</head>
<body>
<script id="app" type="text/serenade">
section#todoapp
header#header
form[event:submit=newTodo!]
h1 "todos"
input#new-todo[binding:change=@newTitle placeholder="What needs to be done?" autofocus="autofocus"]
input#new-todo[binding:change=@newTitle placeholder="What needs to be done?" autofocus="autofocus"]
- if @allCount
section#main
input#toggle-all[type="checkbox" binding:change=@allCompleted]
- if @allCount
section#main
input#toggle-all[type="checkbox" binding:change=@allCompleted]
label[for="toggle-all"] "Mark all as complete"
label[for="toggle-all"] "Mark all as complete"
ul#todo-list
- collection @filtered
- view "todo"
ul#todo-list
- collection @filtered
- view "todo"
footer#footer
span#todo-count
strong @activeCount
" "
@label
footer#footer
span#todo-count
strong @activeCount
" "
@label
ul#filters
li
a.all[class:selected=@filterAll href="#/"] "All"
li
a.active[class:selected=@filterActive href="#/active"] "Active"
li
a.completed[class:selected=@filterCompleted href="#/completed"] "Completed"
- if @completedCount
button#clear-completed[event:click=clearCompleted]
"Clear completed (" @completedCount ")"
</script>
ul#filters
li
a.all[class:selected=@filterAll href="#/"] "All"
li
a.active[class:selected=@filterActive href="#/active"] "Active"
li
a.completed[class:selected=@filterCompleted href="#/completed"] "Completed"
- if @completedCount
button#clear-completed[event:click=clearCompleted]
"Clear completed (" @completedCount ")"
</script>
<script id="todo" type="text/serenade">
li[class:editing=@edit class:completed=@completed]
form[event:submit=edited!]
input.edit[on:load=loadField event:blur=edited! binding:change=@title]
<script id="todo" type="text/serenade">
li[class:editing=@edit class:completed=@completed]
form[event:submit=edited!]
input.edit[on:load=loadField event:blur=edited! binding:change=@title]
- unless @edit
input.toggle[type="checkbox" binding:change=@completed]
label[event:dblclick=edit] @title
button.destroy[event:click=removeTodo]
</script>
- unless @edit
input.toggle[type="checkbox" binding:change=@completed]
label[event:dblclick=edit] @title
button.destroy[event:click=removeTodo]
</script>
</head>
<body>
<footer id="info">
<p>Double-click to edit a todo</p>
<p>Created by <a href="http://elabs.se">Elabs</a></p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer>
<script src="../../../assets/base.js"></script>
<script src="../../../assets/director.min.js"></script>
<script src="components/todomvc-common/base.js"></script>
<script src="components/director/build/director.js"></script>
<script src="js/lib/serenade.js"></script>
<script src="js/app.js"></script>
</body>
......
class Todo extends Serenade.Model
@belongsTo 'app', inverseOf: 'all', as: -> App
@property 'title', serialize: true
@belongsTo 'app', inverseOf: 'all', as: -> App
@property 'title', serialize: true
@property 'completed', serialize: true
@property 'incomplete',
get: -> not @completed
@property 'completed', serialize: true
@property 'incomplete',
get: -> not @completed
@property 'edit'
@property 'edit'
remove: ->
@app.all.delete(this)
remove: ->
@app.all.delete(this)
class App extends Serenade.Model
@hasMany 'all', inverseOf: 'app', serialize: true, as: -> Todo
@hasMany 'all', inverseOf: 'app', serialize: true, as: -> Todo
@selection 'active', from: 'all', filter: 'incomplete'
@selection 'completed', from: 'all', filter: 'completed'
@selection 'active', from: 'all', filter: 'incomplete'
@selection 'completed', from: 'all', filter: 'completed'
@property 'label',
get: -> if @activeCount is 1 then 'item left' else 'items left'
@property 'label',
get: -> if @activeCount is 1 then 'item left' else 'items left'
@property 'allCompleted',
get: -> @activeCount is 0
set: (value) -> todo.completed = value for todo in @all
@property 'allCompleted',
get: -> @activeCount is 0
set: (value) -> todo.completed = value for todo in @all
@property 'newTitle'
@property 'newTitle'
@property 'filter', value: 'all'
@property 'filtered', get: -> @[@filter]
@property 'filter', value: 'all'
@property 'filtered', get: -> @[@filter]
@property 'filterAll', get: -> @filter is 'all'
@property 'filterActive', get: -> @filter is 'active'
@property 'filterCompleted', get: -> @filter is 'completed'
@property 'filterAll', get: -> @filter is 'all'
@property 'filterActive', get: -> @filter is 'active'
@property 'filterCompleted', get: -> @filter is 'completed'
class AppController
constructor: (@app) ->
constructor: (@app) ->
newTodo: ->
title = @app.newTitle.trim()
@app.all.push(title: title) if title
@app.newTitle = ''
newTodo: ->
title = @app.newTitle.trim()
@app.all.push(title: title) if title
@app.newTitle = ''
clearCompleted: ->
@app.all = @app.active
clearCompleted: ->
@app.all = @app.active
class TodoController
constructor: (@todo) ->
constructor: (@todo) ->
removeTodo: ->
@todo.remove()
removeTodo: ->
@todo.remove()
edit: ->
@todo.edit = true
@field.select()
edit: ->
@todo.edit = true
@field.select()
edited: ->
if @todo.title.trim()
@todo.edit = false if @todo.edit
else
@todo.remove()
@todo.app.changed.trigger()
edited: ->
if @todo.title.trim()
@todo.edit = false if @todo.edit
else
@todo.remove()
@todo.app.changed.trigger()
loadField: (@field) ->
loadField: (@field) ->
app = new App(JSON.parse(localStorage.getItem('todos-serenade')))
app.changed.bind -> localStorage.setItem('todos-serenade', app)
router = Router
'/': -> app.filter = 'all'
'/active': -> app.filter = 'active'
'/completed': -> app.filter = 'completed'
'/': -> app.filter = 'all'
'/active': -> app.filter = 'active'
'/completed': -> app.filter = 'completed'
router.init()
......
// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {
var App, AppController, Todo, TodoController, app, router,
var App, AppController, Todo, TodoController, app, router, _ref, _ref1,
__hasProp = {}.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; };
Todo = (function(_super) {
__extends(Todo, _super);
function Todo() {
return Todo.__super__.constructor.apply(this, arguments);
_ref = Todo.__super__.constructor.apply(this, arguments);
return _ref;
}
Todo.belongsTo('app', {
......@@ -44,11 +44,11 @@
})(Serenade.Model);
App = (function(_super) {
__extends(App, _super);
function App() {
return App.__super__.constructor.apply(this, arguments);
_ref1 = App.__super__.constructor.apply(this, arguments);
return _ref1;
}
App.hasMany('all', {
......@@ -84,11 +84,12 @@
return this.activeCount === 0;
},
set: function(value) {
var todo, _i, _len, _ref, _results;
_ref = this.all;
var todo, _i, _len, _ref2, _results;
_ref2 = this.all;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
todo = _ref[_i];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
todo = _ref2[_i];
_results.push(todo.completed = value);
}
return _results;
......@@ -130,13 +131,13 @@
})(Serenade.Model);
AppController = (function() {
function AppController(app) {
this.app = app;
}
AppController.prototype.newTodo = function() {
var title;
title = this.app.newTitle.trim();
if (title) {
this.app.all.push({
......@@ -155,7 +156,6 @@
})();
TodoController = (function() {
function TodoController(todo) {
this.todo = todo;
}
......@@ -188,10 +188,10 @@
})();
app = new App(JSON.parse(localStorage.getItem('todomvc-serenade')));
app = new App(JSON.parse(localStorage.getItem('todos-serenade')));
app.changed.bind(function() {
return localStorage.setItem('todomvc-serenade', app);
return localStorage.setItem('todos-serenade', app);
});
router = Router({
......
/**
* Serenade.js JavaScript Framework v0.4.0
* Revision: 5301262146
* Serenade.js JavaScript Framework v0.4.1
* Revision: ae7d321b18
* http://github.com/elabs/serenade.js
*
* Copyright 2011, Jonas Nicklas, Elabs AB
* Released under the MIT License
*/
(function(e){var t=function(){function t(){this.yy={}}var e={trace:function(){},yy:{},symbols_:{error:2,Root:3,Element:4,ElementIdentifier:5,AnyIdentifier:6,"#":7,".":8,"[":9,"]":10,PropertyList:11,WHITESPACE:12,Text:13,INDENT:14,ChildList:15,OUTDENT:16,TextList:17,Bound:18,STRING_LITERAL:19,Child:20,TERMINATOR:21,IfInstruction:22,Instruction:23,Helper:24,Property:25,"=":26,"!":27,":":28,"-":29,VIEW:30,COLLECTION:31,UNLESS:32,IN:33,IDENTIFIER:34,IF:35,ElseInstruction:36,ELSE:37,"@":38,$accept:0,$end:1},terminals_:{2:"error",7:"#",8:".",9:"[",10:"]",12:"WHITESPACE",14:"INDENT",16:"OUTDENT",19:"STRING_LITERAL",21:"TERMINATOR",26:"=",27:"!",28:":",29:"-",30:"VIEW",31:"COLLECTION",32:"UNLESS",33:"IN",34:"IDENTIFIER",35:"IF",37:"ELSE",38:"@"},productions_:[0,[3,0],[3,1],[5,1],[5,3],[5,2],[5,2],[5,3],[4,1],[4,3],[4,4],[4,3],[4,4],[17,1],[17,3],[13,1],[13,1],[15,1],[15,3],[20,1],[20,1],[20,1],[20,1],[20,1],[11,1],[11,3],[25,3],[25,3],[25,4],[25,4],[25,3],[25,3],[23,5],[23,5],[23,5],[23,5],[23,4],[24,3],[24,3],[24,4],[22,5],[22,4],[22,2],[36,6],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[18,2],[18,1]],performAction:function(t,n,r,i,s,o,u){var a=o.length-1;switch(s){case 1:this.$=null;break;case 2:return this.$;case 3:this.$={name:o[a],classes:[]};break;case 4:this.$={name:o[a-2],id:o[a],classes:[]};break;case 5:this.$={name:"div",id:o[a],classes:[]};break;case 6:this.$={name:"div",classes:[o[a]]};break;case 7:this.$=function(){return o[a-2].classes.push(o[a]),o[a-2]}();break;case 8:this.$={name:o[a].name,id:o[a].id,classes:o[a].classes,properties:[],children:[],type:"element"};break;case 9:this.$=o[a-2];break;case 10:this.$=function(){return o[a-3].properties=o[a-1],o[a-3]}();break;case 11:this.$=function(){return o[a-2].children=o[a-2].children.concat(o[a]),o[a-2]}();break;case 12:this.$=function(){return o[a-3].children=o[a-3].children.concat(o[a-1]),o[a-3]}();break;case 13:this.$=[o[a]];break;case 14:this.$=o[a-2].concat(o[a]);break;case 15:this.$={type:"text",value:o[a],bound:!0};break;case 16:this.$={type:"text",value:o[a],bound:!1};break;case 17:this.$=[].concat(o[a]);break;case 18:this.$=o[a-2].concat(o[a]);break;case 19:this.$=o[a];break;case 20:this.$=o[a];break;case 21:this.$=o[a];break;case 22:this.$=o[a];break;case 23:this.$=o[a];break;case 24:this.$=[o[a]];break;case 25:this.$=o[a-2].concat(o[a]);break;case 26:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case 27:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case 28:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case 29:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case 30:this.$={name:o[a-2],value:o[a],bound:!1,scope:"attribute"};break;case 31:this.$=function(){return o[a].scope=o[a-2],o[a]}();break;case 32:this.$={children:[],type:"view",argument:o[a]};break;case 33:this.$={children:[],type:"collection",argument:o[a]};break;case 34:this.$={children:[],type:"unless",argument:o[a]};break;case 35:this.$={children:[],type:"in",argument:o[a]};break;case 36:this.$=function(){return o[a-3].children=o[a-1],o[a-3]}();break;case 37:this.$={command:o[a],arguments:[],children:[],type:"helper"};break;case 38:this.$=function(){return o[a-2].arguments.push(o[a]),o[a-2]}();break;case 39:this.$=function(){return o[a-3].children=o[a-1],o[a-3]}();break;case 40:this.$={children:[],type:"if",argument:o[a]};break;case 41:this.$=function(){return o[a-3].children=o[a-1],o[a-3]}();break;case 42:this.$=function(){return o[a-1]["else"]=o[a],o[a-1]}();break;case 43:this.$={arguments:[],children:o[a-1],type:"else"};break;case 44:this.$=o[a];break;case 45:this.$=o[a];break;case 46:this.$=o[a];break;case 47:this.$=o[a];break;case 48:this.$=o[a];break;case 49:this.$=o[a];break;case 50:this.$=o[a];break;case 51:this.$=function(){}()}},table:[{1:[2,1],3:1,4:2,5:3,6:4,7:[1,5],8:[1,6],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{1:[3]},{1:[2,2],9:[1,13],12:[1,14],14:[1,15]},{1:[2,8],8:[1,16],9:[2,8],12:[2,8],14:[2,8],16:[2,8],21:[2,8]},{1:[2,3],7:[1,17],8:[2,3],9:[2,3],12:[2,3],14:[2,3],16:[2,3],21:[2,3]},{6:18,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{6:19,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{1:[2,44],7:[2,44],8:[2,44],9:[2,44],10:[2,44],12:[2,44],14:[2,44],16:[2,44],21:[2,44],26:[2,44],27:[2,44],28:[2,44],29:[2,44]},{1:[2,45],7:[2,45],8:[2,45],9:[2,45],10:[2,45],12:[2,45],14:[2,45],16:[2,45],21:[2,45],26:[2,45],27:[2,45],28:[2,45],29:[2,45]},{1:[2,46],7:[2,46],8:[2,46],9:[2,46],10:[2,46],12:[2,46],14:[2,46],16:[2,46],21:[2,46],26:[2,46],27:[2,46],28:[2,46],29:[2,46]},{1:[2,47],7:[2,47],8:[2,47],9:[2,47],10:[2,47],12:[2,47],14:[2,47],16:[2,47],21:[2,47],26:[2,47],27:[2,47],28:[2,47],29:[2,47]},{1:[2,48],7:[2,48],8:[2,48],9:[2,48],10:[2,48],12:[2,48],14:[2,48],16:[2,48],21:[2,48],26:[2,48],27:[2,48],28:[2,48],29:[2,48]},{1:[2,49],7:[2,49],8:[2,49],9:[2,49],10:[2,49],12:[2,49],14:[2,49],16:[2,49],21:[2,49],26:[2,49],27:[2,49],28:[2,49],29:[2,49]},{6:23,10:[1,20],11:21,25:22,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{13:24,18:25,19:[1,26],38:[1,27]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,15:28,17:34,18:25,19:[1,26],20:29,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{6:37,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{6:38,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{1:[2,5],8:[2,5],9:[2,5],12:[2,5],14:[2,5],16:[2,5],21:[2,5]},{1:[2,6],8:[2,6],9:[2,6],12:[2,6],14:[2,6],16:[2,6],21:[2,6]},{1:[2,9],9:[2,9],12:[2,9],14:[2,9],16:[2,9],21:[2,9]},{10:[1,39],12:[1,40]},{10:[2,24],12:[2,24]},{26:[1,41],28:[1,42]},{1:[2,11],9:[2,11],12:[2,11],14:[2,11],16:[2,11],21:[2,11]},{1:[2,15],9:[2,15],12:[2,15],14:[2,15],16:[2,15],21:[2,15]},{1:[2,16],9:[2,16],12:[2,16],14:[2,16],16:[2,16],21:[2,16]},{1:[2,51],6:43,9:[2,51],10:[2,51],12:[2,51],14:[2,51],16:[2,51],21:[2,51],27:[2,51],29:[2,51],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{16:[1,44],21:[1,45]},{16:[2,17],21:[2,17]},{9:[1,13],12:[1,14],14:[1,15],16:[2,19],21:[2,19]},{14:[1,46],16:[2,20],21:[2,20],29:[1,48],36:47},{14:[1,49],16:[2,21],21:[2,21]},{12:[1,50],14:[1,51],16:[2,22],21:[2,22]},{12:[1,52],16:[2,23],21:[2,23]},{12:[1,53]},{12:[2,13],16:[2,13],21:[2,13]},{1:[2,7],8:[2,7],9:[2,7],12:[2,7],14:[2,7],16:[2,7],21:[2,7]},{1:[2,4],8:[2,4],9:[2,4],12:[2,4],14:[2,4],16:[2,4],21:[2,4]},{1:[2,10],9:[2,10],12:[2,10],14:[2,10],16:[2,10],21:[2,10]},{6:23,25:54,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{6:55,18:56,19:[1,57],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{6:23,25:58,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{1:[2,50],9:[2,50],10:[2,50],12:[2,50],14:[2,50],16:[2,50],21:[2,50],27:[2,50],29:[2,50]},{1:[2,12],9:[2,12],12:[2,12],14:[2,12],16:[2,12],21:[2,12]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,17:34,18:25,19:[1,26],20:59,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,15:60,17:34,18:25,19:[1,26],20:29,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{14:[2,42],16:[2,42],21:[2,42],29:[2,42]},{12:[1,61]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,15:62,17:34,18:25,19:[1,26],20:29,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{13:63,18:25,19:[1,26],38:[1,27]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,15:64,17:34,18:25,19:[1,26],20:29,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{13:65,18:25,19:[1,26],38:[1,27]},{30:[1,67],31:[1,68],32:[1,69],33:[1,70],34:[1,71],35:[1,66]},{10:[2,25],12:[2,25]},{10:[2,26],12:[2,26],27:[1,72]},{10:[2,27],12:[2,27],27:[1,73]},{10:[2,30],12:[2,30]},{10:[2,31],12:[2,31]},{16:[2,18],21:[2,18]},{16:[1,74],21:[1,45]},{37:[1,75]},{16:[1,76],21:[1,45]},{12:[2,38],14:[2,38],16:[2,38],21:[2,38]},{16:[1,77],21:[1,45]},{12:[2,14],16:[2,14],21:[2,14]},{12:[1,78]},{12:[1,79]},{12:[1,80]},{12:[1,81]},{12:[1,82]},{12:[2,37],14:[2,37],16:[2,37],21:[2,37]},{10:[2,28],12:[2,28]},{10:[2,29],12:[2,29]},{14:[2,41],16:[2,41],21:[2,41],29:[2,41]},{14:[1,83]},{14:[2,36],16:[2,36],21:[2,36]},{12:[2,39],14:[2,39],16:[2,39],21:[2,39]},{18:84,38:[1,27]},{19:[1,85]},{18:86,38:[1,27]},{18:87,38:[1,27]},{18:88,38:[1,27]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,15:89,17:34,18:25,19:[1,26],20:29,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{14:[2,40],16:[2,40],21:[2,40],29:[2,40]},{14:[2,32],16:[2,32],21:[2,32]},{14:[2,33],16:[2,33],21:[2,33]},{14:[2,34],16:[2,34],21:[2,34]},{14:[2,35],16:[2,35],21:[2,35]},{16:[1,90],21:[1,45]},{14:[2,43],16:[2,43],21:[2,43],29:[2,43]}],defaultActions:{},parseError:function(t,n){throw new Error(t)},parse:function(t){function v(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}function m(){var e;return e=n.lexer.lex()||1,typeof e!="number"&&(e=n.symbols_[e]||e),e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var p=this.lexer.yylloc;s.push(p);var d=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var g,y,b,w,E,S,x={},T,N,C,k;for(;;){b=r[r.length-1];if(this.defaultActions[b])w=this.defaultActions[b];else{if(g===null||typeof g=="undefined")g=m();w=o[b]&&o[b][g]}if(typeof w=="undefined"||!w.length||!w[0])var L="";if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(w[0]){case 1:r.push(g),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(w[1]),g=null,y?(g=y,y=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:N=this.productions_[w[1]][1],x.$=i[i.length-N],x._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column},d&&(x._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]),S=this.performAction.call(x,u,f,a,this.yy,w[1],i,s);if(typeof S!="undefined")return S;N&&(r=r.slice(0,-1*N*2),i=i.slice(0,-1*N),s=s.slice(0,-1*N)),r.push(this.productions_[w[1]][0]),i.push(x.$),s.push(x._$),C=o[r[r.length-2]][r[r.length-1]],r.push(C);break;case 3:return!0}}return!0}};return t.prototype=e,e.Parser=t,new t}();typeof require!="undefined"&&typeof exports!="undefined"&&(exports.parser=t,exports.Parser=t.Parser,exports.parse=function(){return t.parse.apply(t,arguments)},exports.main=function(t){if(!t[1])throw new Error("Usage: "+t[0]+" FILE");var n,r;return typeof process!="undefined"?n=require("fs").readFileSync(require("path").resolve(t[1]),"utf8"):n=require("file").path(require("file").cwd()).join(t[1]).read({charset:"utf-8"}),exports.parser.parse(n)},typeof module!="undefined"&&require.main===module&&exports.main(typeof process!="undefined"?process.argv.slice(1):require("system").args));var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z={}.hasOwnProperty,W=[].slice,X=function(e,t){function r(){this.constructor=e}for(var n in t)z.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},V=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1};R={async:!1},C=Object.defineProperty,A=function(e,t,n){var r,i,s;n==null&&(n=!0),s=[];for(r in t){if(!z.call(t,r))continue;i=t[r],n?s.push(e[r]=i):s.push(C(e,r,{value:i,configurable:!0}))}return s},O=function(e,t){return e[t+"_property"]?e[t+"_property"].format():e[t]},P=function(e){return Object.prototype.toString.call(e)==="[object Array]"},j=function(e,t){var n;return n={},n[e]=t,n},q=function(e){var t,n,r,i;if(e&&typeof e.toJSON=="function")return e.toJSON();if(P(e)){i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(q(t));return i}return e},x=function(e){return e.slice(0,1).toUpperCase()+e.slice(1)},I=function(e,t,n){if(!e[t]||e[t].indexOf(n)===-1)return e.hasOwnProperty(t)?e[t].push(n):e[t]?C(e,t,{value:[n].concat(e[t])}):C(e,t,{value:[n]})},F=function(e,t,n){var r;if(e[t]&&(r=e[t].indexOf(n))!==-1)return e.hasOwnProperty(t)||C(e,t,{value:[].concat(e[t])}),e[t].splice(r,1)},a=function(){function e(e,t,n){this.object=e,this.name=t,this.options=n,this.prop="_s_"+this.name+"_listeners",this.queueName="_s_"+t+"_queue",this.async="async"in this.options?this.options.async:R.async}return e.prototype.trigger=function(){var e,t,n=this;return e=1<=arguments.length?W.call(arguments,0):[],this.queue.push(e),this.async?(t=this.queue).timeout||(t.timeout=setTimeout(function(){return n.resolve()},0)):this.resolve()},e.prototype.bind=function(e){return this.options.bind&&this.options.bind.call(this.object,e),I(this.object,this.prop,e)},e.prototype.one=function(e){var t,n=this;return t=function(e){return n.unbind(e)},this.bind(function(){return t(arguments.callee),e.apply(this,arguments)})},e.prototype.unbind=function(e){F(this.object,this.prop,e);if(this.options.unbind)return this.options.unbind.call(this.object,e)},e.prototype.resolve=function(){var e,t,n,r,i,s=this;t=function(e){if(s.object[s.prop])return s.object[s.prop].forEach(function(t){return t.apply(s.object,e)})};if(this.options.optimize)t(this.options.optimize(this.queue));else{i=this.queue;for(n=0,r=i.length;n<r;n++)e=i[n],t(e)}return this.queue=[]},C(e.prototype,"listeners",{get:function(){return this.object[this.prop]}}),C(e.prototype,"queue",{get:function(){return this.object.hasOwnProperty(this.queueName)||(this.queue=[]),this.object[this.queueName]},set:function(e){return C(this.object,this.queueName,{value:e,configurable:!0})}}),e}(),k=function(e,t,n){return n==null&&(n={}),C(e,t,{configurable:!0,get:function(){return new a(this,t,n)}})},i={_identityMap:{},get:function(e,t){var n,r;n=e.uniqueId();if(n&&t)return(r=this._identityMap[n])!=null?r[t]:void 0},set:function(e,t,n){var r,i;r=e.uniqueId();if(r&&t)return(i=this._identityMap)[r]||(i[r]={}),this._identityMap[r][t]=n},unset:function(e,t){var n,r;n=e.uniqueId();if(n&&t)return(r=this._identityMap)[n]||(r[n]={}),delete this._identityMap[n][t]}},H=function(e){return(""+e).match(/^\d+$/)},s=function(){function i(e){var t,n,r,i;e==null&&(e=[]);for(t=r=0,i=e.length;r<i;t=++r)n=e[t],this[t]=n;this.length=(e!=null?e.length:void 0)||0}var e,t,n,r;k(i.prototype,"change_set"),k(i.prototype,"change_add"),k(i.prototype,"change_update"),k(i.prototype,"change_insert"),k(i.prototype,"change_delete"),k(i.prototype,"change"),i.prototype.get=function(e){return this[e]},i.prototype.set=function(e,t){return this[e]=t,H(e)&&(this.length=Math.max(this.length,e+1)),this.change_set.trigger(e,t),this.change.trigger(this),t},i.prototype.update=function(e){var t,n,r,i,s,o;n=this.clone();for(t in this)i=this[t],H(t)&&delete this[t];for(t=s=0,o=e.length;s<o;t=++s)r=e[t],this[t]=r;return this.length=(e!=null?e.length:void 0)||0,this.change_update.trigger(n,this),this.change.trigger(this),e},i.prototype.sortBy=function(e){return this.sort(function(t,n){return t[e]<n[e]?-1:1})},i.prototype.includes=function(e){return this.indexOf(e)>=0},i.prototype.find=function(e){var t,n,r;for(n=0,r=this.length;n<r;n++){t=this[n];if(e(t))return t}},i.prototype.insertAt=function(e,t){return Array.prototype.splice.call(this,e,0,t),this.change_insert.trigger(e,t),this.change.trigger(this),t},i.prototype.deleteAt=function(e){var t;return t=this[e],Array.prototype.splice.call(this,e,1),this.change_delete.trigger(e,t),this.change.trigger(this),t},i.prototype["delete"]=function(e){var t;t=this.indexOf(e);if(t!==-1)return this.deleteAt(t)},i.prototype.first=function(){return this[0]},i.prototype.last=function(){return this[this.length-1]},i.prototype.toArray=function(){var e,t,n;e=[];for(t in this)n=this[t],H(t)&&(e[t]=n);return e},i.prototype.clone=function(){return new i(this.toArray())},i.prototype.push=function(e){return this[this.length++]=e,this.change_add.trigger(e),this.change.trigger(this),e},i.prototype.pop=function(){return this.deleteAt(this.length-1)},i.prototype.unshift=function(e){return this.insertAt(0,e)},i.prototype.shift=function(){return this.deleteAt(0)},i.prototype.splice=function(){var e,t,n,r,s;return s=arguments[0],e=arguments[1],n=3<=arguments.length?W.call(arguments,2):[],r=this.clone(),t=Array.prototype.splice.apply(this,[s,e].concat(W.call(n))),this.change_update.trigger(r,this),this.change.trigger(this),new i(t)},i.prototype.sort=function(e){var t;return t=this.clone(),Array.prototype.sort.call(this,e),this.change_update.trigger(t,this),this.change.trigger(this),this},i.prototype.reverse=function(){var e;return e=this.clone(),Array.prototype.reverse.call(this),this.change_update.trigger(e,this),this.change.trigger(this),this},r=["forEach","indexOf","lastIndexOf","join","every","some","reduce","reduceRight"];for(t=0,n=r.length;t<n;t++)e=r[t],i.prototype[e]=Array.prototype[e];return i.prototype.map=function(){var e;return e=1<=arguments.length?W.call(arguments,0):[],new i(Array.prototype.map.apply(this,e))},i.prototype.filter=function(){var e;return e=1<=arguments.length?W.call(arguments,0):[],new i(Array.prototype.filter.apply(this,e))},i.prototype.slice=function(){var e,t;return e=1<=arguments.length?W.call(arguments,0):[],new i((t=this.toArray()).slice.apply(t,e))},i.prototype.concat=function(){var e,t,n;return t=1<=arguments.length?W.call(arguments,0):[],t=function(){var n,r,s;s=[];for(n=0,r=t.length;n<r;n++)e=t[n],e instanceof i?s.push(e.toArray()):s.push(e);return s}(),new i((n=this.toArray()).concat.apply(n,t))},i.prototype.toString=function(){return this.toArray().toString()},i.prototype.toLocaleString=function(){return this.toArray().toLocaleString()},i.prototype.toJSON=function(){return q(this.toArray())},i}(),n=function(e){function t(e,n,r){var i=this;this.owner=e,this.options=n,this._convert.apply(this,W.call(r).concat([function(){var e;return e=1<=arguments.length?W.call(arguments,0):[],t.__super__.constructor.call(i,e)}]))}return X(t,e),t.prototype.set=function(e,n){var r=this;return this._convert(n,function(n){return t.__super__.set.call(r,e,n)})},t.prototype.push=function(e){var n=this;return this._convert(e,function(e){return t.__super__.push.call(n,e)})},t.prototype.update=function(e){var n=this;return this._convert.apply(this,W.call(e).concat([function(){var e;return e=1<=arguments.length?W.call(arguments,0):[],t.__super__.update.call(n,e)}]))},t.prototype.splice=function(){var e,n,r,i=this;return r=arguments[0],e=arguments[1],n=3<=arguments.length?W.call(arguments,2):[],this._convert.apply(this,W.call(n).concat([function(){var n;return n=1<=arguments.length?W.call(arguments,0):[],t.__super__.splice.apply(i,[r,e].concat(W.call(n)))}]))},t.prototype.insertAt=function(e,n){var r=this;return this._convert(n,function(n){return t.__super__.insertAt.call(r,e,n)})},t.prototype._convert=function(){var e,t,n,r,i,s,o;n=2<=arguments.length?W.call(arguments,0,i=arguments.length-1):(i=0,[]),e=arguments[i++],n=function(){var e,r,i;i=[];for(e=0,r=n.length;e<r;e++)t=n[e],(t!=null?t.constructor:void 0)===Object&&this.options.as?i.push(t=new(this.options.as())(t)):i.push(t);return i}.call(this),r=e.apply(null,n);for(s=0,o=n.length;s<o;s++)t=n[s],this.options.inverseOf&&t[this.options.inverseOf]!==this.owner&&(t[this.options.inverseOf]=this.owner);return r},t}(s),_={},U=function(e,t){var n,r,i,s,o,u,a,f;f=[];for(u=0,a=t.length;u<a;u++)r=t[u],_.hasOwnProperty(r)?f.push(function(){var t,u,a,f,l,c,h;a=_[r],h=[];for(t=0,u=a.length;t<u;t++)f=a[t],r=f.name,o=f.type,i=f.object,s=f.subname,n=f.dependency,o==="singular"?e===i[r]?h.push((l=i[n+"_property"])!=null?typeof l.trigger=="function"?l.trigger(i):void 0:void 0):h.push(void 0):o==="collection"?V.call(i[r],e)>=0?h.push((c=i[n+"_property"])!=null?typeof c.trigger=="function"?c.trigger(i):void 0:void 0):h.push(void 0):h.push(void 0);return h}()):f.push(void 0);return f},y=function(){function e(e,t){var n,r,i;this.name=e,A(this,t),this.dependencies=[],this.localDependencies=[],this.globalDependencies=[];if(this.dependsOn){i=[].concat(this.dependsOn);for(n=0,r=i.length;n<r;n++)e=i[n],this.addDependency(e)}this.async="async"in t?t.async:R.async,this.eventOptions={async:this.async,bind:function(){return this[e]},optimize:function(e){return e[e.length-1]}}}return e.prototype.addDependency=function(e){var t,n,r,i;if(this.dependencies.indexOf(e)===-1){this.dependencies.push(e),e.match(/\./)?(n="singular",r=e.split("."),e=r[0],t=r[1]):e.match(/:/)&&(n="collection",i=e.split(":"),e=i[0],t=i[1]),this.localDependencies.push(e),this.localDependencies.indexOf(e)===-1&&this.localDependencies.push(e);if(n)return this.globalDependencies.push({subname:t,name:e,type:n})}},e}(),g=function(){function e(e,t){this.definition=e,this.object=t,this.name=this.definition.name,this.valueName="_s_"+this.name+"_val",this.event=new a(this.object,this.name+"_change",this.definition.eventOptions)}return e.prototype.set=function(e){return typeof e=="function"?this.definition.get=e:(this.definition.set?this.definition.set.call(this.object,e):C(this.object,this.valueName,{value:e,configurable:!0}),this.trigger())},e.prototype.get=function(){var e,t,n=this;return this.registerGlobal(),this.definition.get?(e=function(e){return n.definition.addDependency(e)},"dependsOn"in this.definition||this.object._s_property_access.bind(e),t=this.definition.get.call(this.object),"dependsOn"in this.definition||this.object._s_property_access.unbind(e)):t=this.object[this.valueName],this.object._s_property_access.trigger(this.name),t},e.prototype.format=function(){return typeof this.definition.format=="function"?this.definition.format.call(this.object,this.get()):this.get()},e.prototype.registerGlobal=function(){var e,t,n,r,i,s,o,u;if(!this.object["_s_glb_"+this.name]){C(this.object,"_s_glb_"+this.name,{value:!0,configurable:!0}),s=this.definition.globalDependencies,u=[];for(r=0,i=s.length;r<i;r++)o=s[r],e=o.name,n=o.type,t=o.subname,_[t]||(_[t]=[]),u.push(_[t].push({object:this.object,subname:t,name:e,type:n,dependency:this.name}));return u}},e.prototype.trigger=function(){var e,t,n,r,i,s,o,u;n=[this.name].concat(this.dependents),e={};for(i=0,s=n.length;i<s;i++)t=n[i],e[t]=this.object[t];(o=this.object.changed)!=null&&typeof o.trigger=="function"&&o.trigger(e),U(this.object,n),u=[];for(t in e){if(!z.call(e,t))continue;r=e[t],u.push(this.object[t+"_property"].event.trigger(r))}return u},e.prototype.bind=function(e){return this.event.bind(e)},e.prototype.unbind=function(e){return this.event.unbind(e)},e.prototype.one=function(e){return this.event.one(e)},C(e.prototype,"dependents",{get:function(){var e,t,n=this;return e=[],t=function(r){var i,s,o,u,a,f;u=n.object._s_properties,f=[];for(s=0,o=u.length;s<o;s++)i=u[s],(a=i.name,V.call(e,a)<0)&&V.call(i.localDependencies,r)>=0?(e.push(i.name),f.push(t(i.name))):f.push(void 0);return f},t(this.name),e}}),C(e.prototype,"listeners",{get:function(){return this.event.listeners}}),e}(),L=function(e,t,n){var r;n==null&&(n={}),r=new y(t,n),I(e,"_s_properties",r),k(e,"_s_property_access"),C(e,t,{get:function(){return this[t+"_property"].get()},set:function(e){return this[t+"_property"].set(e)},configurable:!0,enumerable:"enumerable"in n?n.enumerable:!0}),C(e,t+"_property",{get:function(){return new g(r,this)},configurable:!0}),typeof n.serialize=="string"&&L(e,n.serialize,{get:function(){return this[t]},set:function(e){return this[t]=e},configurable:!0});if("value"in n)return e[t]=n.value},D=1,d=function(){function e(e){var t;if(this.constructor.identityMap&&(e!=null?e.id:void 0)){t=i.get(this.constructor,e.id);if(t)return t.set(e),t;i.set(this.constructor,e.id,this)}this.set(e)}return k(e.prototype,"saved"),k(e.prototype,"changed",{optimize:function(e){var t,n,r,i;n={};for(r=0,i=e.length;r<i;r++)t=e[r],A(n,t[0]);return[n]}}),e.belongsTo=function(){var e;return(e=this.prototype).belongsTo.apply(e,arguments)},e.hasMany=function(){var e;return(e=this.prototype).hasMany.apply(e,arguments)},e.identityMap=!0,e.find=function(e){return i.get(this,e)||new this({id:e})},e.extend=function(e){var t;return t=function(t){function n(){var t;t=n.__super__.constructor.apply(this,arguments);if(t)return t;e&&e.apply(this,arguments)}return X(n,t),n}(this)},e.property=function(){var e,t,n,r,i,s,o;t=2<=arguments.length?W.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],typeof n=="string"&&(t.push(n),n={}),o=[];for(i=0,s=t.length;i<s;i++)e=t[i],o.push(L(this.prototype,e,n));return o},e.properties=function(){var e,t,n,r,i;t=1<=arguments.length?W.call(arguments,0):[],i=[];for(n=0,r=t.length;n<r;n++)e=t[n],i.push(this.property(e));return i},e.delegate=function(){var e,t,n,r,i=this;return e=2<=arguments.length?W.call(arguments,0,r=arguments.length-1):(r=0,[]),t=arguments[r++],n=t.to,e.forEach(function(e){var r;return r=e,t.prefix===!0?r=n+x(e):t.prefix&&(r=t.prefix+x(e)),t.suffix===!0?r+=x(n):t.suffix&&(r+=t.suffix),i.property(r,{dependsOn:""+n+"."+e,get:function(){var t;return(t=this[n])!=null?t[e]:void 0},set:function(t){var r;return(r=this[n])!=null?r[e]=t:void 0}})})},e.collection=function(e,t){return t==null&&(t={}),A(t,{get:function(){var t,n=this;return t="_s_"+e+"_val",this[t]||(this[t]=new s([]),this[t].change.bind(function(){return n[e+"_property"].trigger()})),this[t]},set:function(t){return this[e].update(t)}}),this.property(e,t),this.property(e+"Count",{get:function(){return this[e].length},dependsOn:e})},e.belongsTo=function(e,t){return t==null&&(t={}),A(t,{set:function(n){var r,i;i="_s_"+e+"_val",n&&n.constructor===Object&&t.as&&(n=new(t.as())(n)),r=this[i],this[i]=n;if(t.inverseOf&&!n[t.inverseOf].includes(this))return r&&r[t.inverseOf]["delete"](this),n[t.inverseOf].push(this)}}),this.property(e,t),this.property(e+"Id",{get:function(){var t;return(t=this[e])!=null?t.id:void 0},set:function(n){if(n!=null)return this[e]=t.as().find(n)},dependsOn:e,serialize:t.serializeId})},e.hasMany=function(e,t){return t==null&&(t={}),A(t,{get:function(){var r,i=this;return r="_s_"+e+"_val",this[r]||(this[r]=new n(this,t,[]),this[r].change.bind(function(){return i[e+"_property"].trigger()})),this[r]},set:function(t){return this[e].update(t)}}),this.property(e,t),this.property(e+"Ids",{get:function(){return(new s(this[e])).map(function(e){return e!=null?e.id:void 0})},set:function(n){var r,i;return i=function(){var e,i,s;s=[];for(e=0,i=n.length;e<i;e++)r=n[e],s.push(t.as().find(r));return s}(),this[e].update(i)},dependsOn:e,serialize:t.serializeIds}),this.property(e+"Count",{get:function(){return this[e].length},dependsOn:e})},e.selection=function(e,t){return t==null&&(t={}),this.property(e,{get:function(){return this[t.from].filter(function(e){return e[t.filter]})},dependsOn:""+t.from+":"+t.filter}),this.property(e+"Count",{get:function(){return this[e].length},dependsOn:e})},e.uniqueId=function(){if(!this._uniqueId||this._uniqueGen!==this)this._uniqueId=D+=1,this._uniqueGen=this;return this._uniqueId},e.property("id",{serialize:!0,set:function(e){return i.unset(this.constructor,this.id),i.set(this.constructor,e,this),C(this,"_s_id_val",{value:e,configurable:!0})},get:function(){return this._s_id_val}}),e.prototype.set=function(e){var t,n,r;r=[];for(t in e){if(!z.call(e,t))continue;n=e[t],t in this||L(this,t),r.push(this[t]=n)}return r},e.prototype.save=function(){return this.saved.trigger()},e.prototype.toJSON=function(){var e,t,n,r,i,s,o,u;n={},o=this._s_properties;for(i=0,s=o.length;i<s;i++)t=o[i],typeof t.serialize=="string"?n[t.serialize]=q(this[t.name]):typeof t.serialize=="function"?(u=t.serialize.call(this),e=u[0],r=u[1],n[e]=q(r)):t.serialize&&(n[t.name]=q(this[t.name]));return n},e.prototype.toString=function(){return JSON.stringify(this.toJSON())},e}(),f=/^[a-zA-Z][a-zA-Z0-9\-_]*/,c=/^[\[\]=\:\-!#\.@]/,b=/^"((?:\\.|[^"])*)"/,p=/^(?:\r?\n[^\r\n\S]*)+/,S=/^[^\r\n\S]+/,r=/^\s*\/\/[^\n]*/,l=["IF","ELSE","COLLECTION","IN","VIEW","UNLESS"],h=function(){function e(){}return e.prototype.tokenize=function(e,t){var n;t==null&&(t={}),this.code=e.replace(/^\s*/,"").replace(/\s*$/,""),this.line=t.line||0,this.indent=0,this.indents=[],this.ends=[],this.tokens=[],this.i=0;while(this.chunk=this.code.slice(this.i))this.i+=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.literalToken();while(n=this.ends.pop())n==="OUTDENT"?this.token("OUTDENT"):this.error("missing "+n);while(this.tokens[0][0]==="TERMINATOR")this.tokens.shift();while(this.tokens[this.tokens.length-1][0]==="TERMINATOR")this.tokens.pop();return this.tokens},e.prototype.commentToken=function(){var e;return(e=r.exec(this.chunk))?e[0].length:0},e.prototype.whitespaceToken=function(){var e;return(e=S.exec(this.chunk))?(this.token("WHITESPACE",e[0].length),e[0].length):0},e.prototype.token=function(e,t){return this.tokens.push([e,t,this.line])},e.prototype.identifierToken=function(){var e,t;return(e=f.exec(this.chunk))?(t=e[0].toUpperCase(),t==="ELSE"&&this.last(this.tokens,2)[0]==="TERMINATOR"&&this.tokens.splice(this.tokens.length-3,1),V.call(l,t)>=0?this.token(t,e[0]):this.token("IDENTIFIER",e[0]),e[0].length):0},e.prototype.stringToken=function(){var e;return(e=b.exec(this.chunk))?(this.token("STRING_LITERAL",e[1]),e[0].length):0},e.prototype.lineToken=function(){var e,t,n,r,i;if(!(n=p.exec(this.chunk)))return 0;t=n[0],this.line+=this.count(t,"\n"),r=this.last(this.tokens,1),i=t.length-1-t.lastIndexOf("\n"),e=i-this.indent;if(i===this.indent)this.newlineToken();else if(i>this.indent)this.token("INDENT"),this.indents.push(e),this.ends.push("OUTDENT");else{while(e<0)this.ends.pop(),e+=this.indents.pop(),this.token("OUTDENT");this.token("TERMINATOR","\n")}return this.indent=i,t.length},e.prototype.literalToken=function(){var e;return(e=c.exec(this.chunk))?(this.token(e[0]),1):this.error("Unexpected token '"+this.chunk.charAt(0)+"'")},e.prototype.newlineToken=function(){if(this.tag()!=="TERMINATOR")return this.token("TERMINATOR","\n")},e.prototype.tag=function(e,t){var n;return(n=this.last(this.tokens,e))&&(t?n[0]=t:n[0])},e.prototype.value=function(e,t){var n;return(n=this.last(this.tokens,e))&&(t?n[1]=t:n[1])},e.prototype.error=function(e){var t;throw t=this.code.slice(Math.max(0,this.i-10),Math.min(this.code.length,this.i+10)),SyntaxError(""+e+" on line "+(this.line+1)+" near "+JSON.stringify(t))},e.prototype.count=function(e,t){var n,r;n=r=0;if(!t.length)return 1/0;while(r=1+e.indexOf(t,r))n++;return n},e.prototype.last=function(e,t){return e[e.length-(t||0)-1]},e}(),v=function(){function e(e,t){this.ast=e,this.element=t,this.children=new s([]),this.boundClasses=new s([])}return k(e.prototype,"load"),k(e.prototype,"unload"),e.prototype.append=function(e){return e.appendChild(this.element)},e.prototype.insertAfter=function(e){return e.parentNode.insertBefore(this.element,e.nextSibling)},e.prototype.remove=function(){var e;return this.unbindEvents(),(e=this.element.parentNode)!=null?e.removeChild(this.element):void 0},e.prototype.lastElement=function(){return this.element},e.prototype.nodes=function(){return this.children},e.prototype.bindEvent=function(e,t){if(e)return this.boundEvents||(this.boundEvents=[]),this.boundEvents.push({event:e,fun:t}),e.bind(t)},e.prototype.unbindEvents=function(){var e,t,n,r,i,s,o,u,a,f,l;this.unload.trigger(),u=this.nodes();for(r=0,s=u.length;r<s;r++)n=u[r],n.unbindEvents();if(this.boundEvents){a=this.boundEvents,l=[];for(i=0,o=a.length;i<o;i++)f=a[i],e=f.event,t=f.fun,l.push(e.unbind(t));return l}},e.prototype.updateClass=function(){var e;return e=this.ast.classes,this.attributeClasses&&(e=e.concat(this.attributeClasses)),this.boundClasses.length&&(e=e.concat(this.boundClasses.toArray())),e.length?this.element.className=e.join(" "):this.element.removeAttribute("class")},e}(),u=function(e){function t(e){this.ast=e,this.anchor=w.document.createTextNode(""),this.nodeSets=new s([])}return X(t,e),t.prototype.nodes=function(){var e,t,n,r,i,s,o,u;t=[],u=this.nodeSets;for(r=0,s=u.length;r<s;r++){n=u[r];for(i=0,o=n.length;i<o;i++)e=n[i],t.push(e)}return t},t.prototype.rebuild=function(){var e,t,n,r,i,s;if(this.anchor.parentNode){e=this.anchor,i=this.nodes(),s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t.insertAfter(e),s.push(e=t.lastElement());return s}},t.prototype.replace=function(e){var t;return this.clear(),this.nodeSets.update(function(){var n,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(new s(t));return i}()),this.rebuild()},t.prototype.appendNodeSet=function(e){return this.insertNodeSet(this.nodeSets.length,e)},t.prototype.deleteNodeSet=function(e){var t,n,r,i;i=this.nodeSets[e];for(n=0,r=i.length;n<r;n++)t=i[n],t.remove();return this.nodeSets.deleteAt(e)},t.prototype.insertNodeSet=function(e,t){var n,r,i,o,u,a;n=((u=this.nodeSets[e-1])!=null?(a=u.last())!=null?a.lastElement():void 0:void 0)||this.anchor;for(i=0,o=t.length;i<o;i++)r=t[i],r.insertAfter(n),n=r.lastElement();return this.nodeSets.insertAt(e,new s(t))},t.prototype.clear=function(){var e,t,n,r;r=this.nodes();for(t=0,n=r.length;t<n;t++)e=r[t],e.remove();return this.nodeSets.update([])},t.prototype.remove=function(){return this.unbindEvents(),this.clear(),this.anchor.parentNode.removeChild(this.anchor)},t.prototype.append=function(e){return e.appendChild(this.anchor),this.rebuild()},t.prototype.insertAfter=function(e){return e.parentNode.insertBefore(this.anchor,e.nextSibling),this.rebuild()},t.prototype.lastElement=function(){var e,t;return((e=this.nodeSets.last())!=null?(t=e.last())!=null?t.lastElement():void 0:void 0)||this.anchor},t}(v),M=function(e,t){return e.bound&&e.value?O(t,e.value):e.value!=null?e.value:t},m={style:function(e,t,n,r){var i;i=function(){return t.element.style[e.name]=M(e,n)},i();if(e.bound)return t.bindEvent(n[""+e.value+"_property"],i)},event:function(e,t,n,r){return t.element.addEventListener(e.name,function(i){return e.preventDefault&&i.preventDefault(),r[e.value](t.element,n,i)})},"class":function(e,t,n,r){var i;return i=function(){return n[e.value]?t.boundClasses.push(e.name):t.boundClasses["delete"](e.name),t.updateClass()},i(),t.bindEvent(n[""+e.value+"_property"],i)},binding:function(e,t,n,r){var i,s,o,u,a;return s=t.element,(a=t.ast.name)==="input"||a==="textarea"||a==="select"||function(){throw SyntaxError("invalid node type "+t.ast.name+" for two way binding")}(),e.value||function(){throw SyntaxError("cannot bind to whole model, please specify an attribute to bind to")}(),i=function(){return n[e.value]=s.type==="checkbox"?s.checked:s.type==="radio"?s.checked?s.getAttribute("value"):void 0:s.value},u=function(){var t;t=n[e.value];if(s.type==="checkbox")return s.checked=!!t;if(s.type==="radio"){if(t===s.getAttribute("value"))return s.checked=!0}else{t===void 0&&(t="");if(s.value!==t)return s.value=t}},u(),t.bindEvent(n[""+e.value+"_property"],u),e.name==="binding"?(o=function(e){if(s.form===(e.target||e.srcElement))return i()},w.document.addEventListener("submit",o,!0),t.unload.bind(function(){return w.document.removeEventListener("submit",o,!0)})):s.addEventListener(e.name,i)},attribute:function(e,t,n,r){var i,s;return e.name==="binding"?m.binding(e,t,n,r):(i=t.element,s=function(){var r;return r=M(e,n),e.name==="value"?i.value=r||"":t.ast.name==="input"&&e.name==="checked"?i.checked=!!r:e.name==="class"?(t.attributeClasses=r,t.updateClass()):r===void 0?i.removeAttribute(e.name):(r===0&&(r="0"),i.setAttribute(e.name,r))},e.bound&&t.bindEvent(n[""+e.value+"_property"],s),s())},on:function(e,t,n,r){var i;if((i=e.name)==="load"||i==="unload")return t[e.name].bind(function(){return r[e.value](t.element,n)});throw new SyntaxError("unkown lifecycle event '"+e.name+"'")}},o={element:function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p,d,g;o=w.document.createElement(e.name),u=new v(e,o),e.id&&o.setAttribute("id",e.id),((p=e.classes)!=null?p.length:void 0)&&o.setAttribute("class",e.classes.join(" ")),d=e.children;for(f=0,c=d.length;f<c;f++)i=d[f],s=T(i,t,n),s.append(o),u.children.push(s);g=e.properties;for(l=0,h=g.length;l<h;l++){a=g[l],r=m[a.scope];if(!r)throw SyntaxError(""+a.scope+" is not a valid scope");r(a,u,t,n)}return u.load.trigger(),u},view:function(e,t,n){var r,i;return r=w.controllerFor(e.argument),r||(i=!0,r=n),w._views[e.argument].node(t,r,n,i)},helper:function(e,t,n){var r,i,s,o,a,f,l,c,h;s=new u(e),a=function(t,n){var r,i,s,o,u,a;t==null&&(t=t),n==null&&(n=n),i=w.document.createDocumentFragment(),a=e.children;for(o=0,u=a.length;o<u;o++)r=a[o],s=T(r,t,n),s.append(i);return i},o=w.Helpers[e.command]||function(){throw SyntaxError("no helper "+e.command+" defined")}(),i={render:a,model:t,controller:n},f=function(){var n,r,u;return n=e.arguments.map(function(e){return e.bound?t[e.value]:e.value}),u=function(){var t,s,u,a;u=B(o.apply(i,n)),a=[];for(t=0,s=u.length;t<s;t++)r=u[t],a.push(new v(e,r));return a}(),s.replace([u])},h=e.arguments;for(l=0,c=h.length;l<c;l++)r=h[l],r.bound===!0&&s.bindEvent(t[""+r.value+"_property"],f);return f(),s},text:function(e,t,n){var r,i,s;return r=function(){var n;return n=M(e,t),n===0&&(n="0"),n||""},s=w.document.createTextNode(r()),i=new v(e,s),e.bound&&i.bindEvent(t[""+e.value+"_property"],function(){return s.nodeValue=r()}),i},collection:function(e,t,n){var r,i,s,o,u=this;return i=function(t){return N(e.children,t,n)},o=function(e,t){var n;return e.replace(function(){var e,r,s;s=[];for(e=0,r=t.length;e<r;e++)n=t[e],s.push(i(n));return s}())},s=this.bound(e,t,n,o),r=t[e.argument],s.bindEvent(r.change_set,function(){var e;return s.replace(function(){var t,n,s;s=[];for(t=0,n=r.length;t<n;t++)e=r[t],s.push(i(e));return s}())}),s.bindEvent(r.change_update,function(){var e;return s.replace(function(){var t,n,s;s=[];for(t=0,n=r.length;t<n;t++)e=r[t],s.push(i(e));return s}())}),s.bindEvent(r.change_add,function(e){return s.appendNodeSet(i(e))}),s.bindEvent(r.change_insert,function(e,t){return s.insertNodeSet(e,i(t))}),s.bindEvent(r.change_delete,function(e){return s.deleteNodeSet(e)}),s},"in":function(e,t,n){return this.bound(e,t,n,function(t,r){return r?t.replace([N(e.children,r,n)]):t.clear()})},"if":function(e,t,n){return this.bound(e,t,n,function(r,i){return i?r.replace([N(e.children,t,n)]):e["else"]?r.replace([N(e["else"].children,t,n)]):r.clear()})},unless:function(e,t,n){return this.bound(e,t,n,function(r,i){var s,o;return i?r.clear():(o=function(){var r,i,o,u;o=e.children,u=[];for(r=0,i=o.length;r<i;r++)s=o[r],u.push(T(s,t,n));return u}(),r.replace([o]))})},bound:function(e,t,n,r){var i,s;return i=new u(e),s=function(){var n;return n=t[e.argument],r(i,n)},s(),i.bindEvent(t[""+e.argument+"_property"],s),i}},B=function(e){var t;return e?(t=function(e,t){var n,r,i,s,o;if(typeof t=="string"){r=w.document.createElement("div"),r.innerHTML=t,o=r.children;for(i=0,s=o.length;i<s;i++)n=o[i],e.push(n)}else e.push(t);return e},[].concat(e).reduce(t,[])):[]},T=function(e,t,n){return o[e.type](e,t,n)},N=function(e,t,n){var r,i,s,o;o=[];for(i=0,s=e.length;i<s;i++)r=e[i],o.push(T(r,t,n));return o},t.lexer={lex:function(){var e,t;return t=this.tokens[this.pos++]||[""],e=t[0],this.yytext=t[1],this.yylineno=t[2],e},setInput:function(e){return this.tokens=e,this.pos=0},upcomingInput:function(){return""}},E=function(){function e(e,t){this.name=e,this.view=t}return e.prototype.parse=function(){if(typeof this.view!="string")return this.view;try{return this.view=t.parse((new h).tokenize(this.view))}catch(e){throw this.name&&(e.message="In view '"+this.name+"': "+e.message),e}},e.prototype.render=function(){var e;return e=1<=arguments.length?W.call(arguments,0):[],this.node.apply(this,e).element},e.prototype.node=function(e,t,n,r){var i;return this.name&&(t||(t=w.controllerFor(this.name,e))),t||(t={}),typeof t=="function"&&(t=new t(e,n)),i=T(this.parse(),e,t),r||typeof t.loaded=="function"&&t.loaded(i.element,e),i},e}(),w=function(e){var t,n,r;n=Object.create(e);for(t in e)r=e[t],L(n,t,{value:r});return n},A(w,{VERSION:"0.4.0",_views:{},_controllers:{},document:typeof window!="undefined"&&window!==null?window.document:void 0,format:O,defineProperty:L,defineEvent:k,asyncEvents:!1,view:function(e,t){return t?this._views[e]=new E(e,t):new E(void 0,e)},render:function(e,t,n,r,i){return this._views[e].render(t,n,r,i)},controller:function(e,t){return this._controllers[e]=t},controllerFor:function(e){return this._controllers[e]},clearIdentityMap:function(){return i._identityMap={}},clearLocalStorage:function(){return i._storage.clear()},clearCache:function(){var e,t,n,r,i;w.clearIdentityMap(),w.clearLocalStorage(),i=[];for(e=n=0,r=_.length;n<r;e=++n)t=_[e],i.push(delete _[e]);return i},unregisterAll:function(){return w._views={},w._controllers={}},Model:d,Collection:s,Cache:i,View:E,Helpers:{}}),C(w,"async",{get:function(){return R.async},set:function(e){return R.async=e}}),e.Serenade=w})(this)
\ No newline at end of file
(function(e){var t=function(){function t(){this.yy={}}var e={trace:function(){},yy:{},symbols_:{error:2,Root:3,ChildList:4,ElementIdentifier:5,AnyIdentifier:6,"#":7,".":8,Element:9,"[":10,"]":11,PropertyList:12,WHITESPACE:13,Text:14,INDENT:15,OUTDENT:16,TextList:17,Bound:18,STRING_LITERAL:19,Child:20,TERMINATOR:21,IfInstruction:22,Instruction:23,Helper:24,Property:25,"=":26,"!":27,":":28,"-":29,VIEW:30,COLLECTION:31,UNLESS:32,IN:33,IDENTIFIER:34,IF:35,ElseInstruction:36,ELSE:37,"@":38,$accept:0,$end:1},terminals_:{2:"error",7:"#",8:".",10:"[",11:"]",13:"WHITESPACE",15:"INDENT",16:"OUTDENT",19:"STRING_LITERAL",21:"TERMINATOR",26:"=",27:"!",28:":",29:"-",30:"VIEW",31:"COLLECTION",32:"UNLESS",33:"IN",34:"IDENTIFIER",35:"IF",37:"ELSE",38:"@"},productions_:[0,[3,0],[3,1],[5,1],[5,3],[5,2],[5,2],[5,3],[9,1],[9,3],[9,4],[9,3],[9,4],[17,1],[17,3],[14,1],[14,1],[4,1],[4,3],[20,1],[20,1],[20,1],[20,1],[20,1],[12,1],[12,3],[25,3],[25,3],[25,4],[25,4],[25,3],[25,3],[23,5],[23,5],[23,5],[23,5],[23,4],[24,3],[24,3],[24,4],[22,5],[22,4],[22,2],[36,6],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[18,2],[18,1]],performAction:function(t,n,r,i,s,o,u){var a=o.length-1;switch(s){case 1:this.$=null;break;case 2:return this.$;case 3:this.$={name:o[a],classes:[]};break;case 4:this.$={name:o[a-2],id:o[a],classes:[]};break;case 5:this.$={name:"div",id:o[a],classes:[]};break;case 6:this.$={name:"div",classes:[o[a]]};break;case 7:this.$=function(){return o[a-2].classes.push(o[a]),o[a-2]}();break;case 8:this.$={name:o[a].name,id:o[a].id,classes:o[a].classes,properties:[],children:[],type:"element"};break;case 9:this.$=o[a-2];break;case 10:this.$=function(){return o[a-3].properties=o[a-1],o[a-3]}();break;case 11:this.$=function(){return o[a-2].children=o[a-2].children.concat(o[a]),o[a-2]}();break;case 12:this.$=function(){return o[a-3].children=o[a-3].children.concat(o[a-1]),o[a-3]}();break;case 13:this.$=[o[a]];break;case 14:this.$=o[a-2].concat(o[a]);break;case 15:this.$={type:"text",value:o[a],bound:!0};break;case 16:this.$={type:"text",value:o[a],bound:!1};break;case 17:this.$=[].concat(o[a]);break;case 18:this.$=o[a-2].concat(o[a]);break;case 19:this.$=o[a];break;case 20:this.$=o[a];break;case 21:this.$=o[a];break;case 22:this.$=o[a];break;case 23:this.$=o[a];break;case 24:this.$=[o[a]];break;case 25:this.$=o[a-2].concat(o[a]);break;case 26:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case 27:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case 28:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case 29:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case 30:this.$={name:o[a-2],value:o[a],bound:!1,scope:"attribute"};break;case 31:this.$=function(){return o[a].scope=o[a-2],o[a]}();break;case 32:this.$={children:[],type:"view",argument:o[a]};break;case 33:this.$={children:[],type:"collection",argument:o[a]};break;case 34:this.$={children:[],type:"unless",argument:o[a]};break;case 35:this.$={children:[],type:"in",argument:o[a]};break;case 36:this.$=function(){return o[a-3].children=o[a-1],o[a-3]}();break;case 37:this.$={command:o[a],arguments:[],children:[],type:"helper"};break;case 38:this.$=function(){return o[a-2].arguments.push(o[a]),o[a-2]}();break;case 39:this.$=function(){return o[a-3].children=o[a-1],o[a-3]}();break;case 40:this.$={children:[],type:"if",argument:o[a]};break;case 41:this.$=function(){return o[a-3].children=o[a-1],o[a-3]}();break;case 42:this.$=function(){return o[a-1]["else"]=o[a],o[a-1]}();break;case 43:this.$={arguments:[],children:o[a-1],type:"else"};break;case 44:this.$=o[a];break;case 45:this.$=o[a];break;case 46:this.$=o[a];break;case 47:this.$=o[a];break;case 48:this.$=o[a];break;case 49:this.$=o[a];break;case 50:this.$=o[a];break;case 51:this.$=function(){}()}},table:[{1:[2,1],3:1,4:2,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{1:[3]},{1:[2,2],21:[1,24]},{1:[2,17],16:[2,17],21:[2,17]},{1:[2,19],10:[1,25],13:[1,26],15:[1,27],16:[2,19],21:[2,19]},{1:[2,20],15:[1,28],16:[2,20],21:[2,20],29:[1,30],36:29},{1:[2,21],15:[1,31],16:[2,21],21:[2,21]},{1:[2,22],13:[1,32],15:[1,33],16:[2,22],21:[2,22]},{1:[2,23],13:[1,34],16:[2,23],21:[2,23]},{1:[2,8],8:[1,35],10:[2,8],13:[2,8],15:[2,8],16:[2,8],21:[2,8]},{13:[1,36]},{1:[2,13],13:[2,13],16:[2,13],21:[2,13]},{1:[2,3],7:[1,37],8:[2,3],10:[2,3],13:[2,3],15:[2,3],16:[2,3],21:[2,3]},{6:38,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{6:39,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{1:[2,15],10:[2,15],13:[2,15],15:[2,15],16:[2,15],21:[2,15]},{1:[2,16],10:[2,16],13:[2,16],15:[2,16],16:[2,16],21:[2,16]},{1:[2,44],7:[2,44],8:[2,44],10:[2,44],11:[2,44],13:[2,44],15:[2,44],16:[2,44],21:[2,44],26:[2,44],27:[2,44],28:[2,44],29:[2,44]},{1:[2,45],7:[2,45],8:[2,45],10:[2,45],11:[2,45],13:[2,45],15:[2,45],16:[2,45],21:[2,45],26:[2,45],27:[2,45],28:[2,45],29:[2,45]},{1:[2,46],7:[2,46],8:[2,46],10:[2,46],11:[2,46],13:[2,46],15:[2,46],16:[2,46],21:[2,46],26:[2,46],27:[2,46],28:[2,46],29:[2,46]},{1:[2,47],7:[2,47],8:[2,47],10:[2,47],11:[2,47],13:[2,47],15:[2,47],16:[2,47],21:[2,47],26:[2,47],27:[2,47],28:[2,47],29:[2,47]},{1:[2,48],7:[2,48],8:[2,48],10:[2,48],11:[2,48],13:[2,48],15:[2,48],16:[2,48],21:[2,48],26:[2,48],27:[2,48],28:[2,48],29:[2,48]},{1:[2,49],7:[2,49],8:[2,49],10:[2,49],11:[2,49],13:[2,49],15:[2,49],16:[2,49],21:[2,49],26:[2,49],27:[2,49],28:[2,49],29:[2,49]},{1:[2,51],6:40,10:[2,51],11:[2,51],13:[2,51],15:[2,51],16:[2,51],21:[2,51],27:[2,51],29:[2,51],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:41,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{6:45,11:[1,42],12:43,25:44,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{14:46,18:15,19:[1,16],38:[1,23]},{4:47,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{4:48,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{1:[2,42],15:[2,42],16:[2,42],21:[2,42],29:[2,42]},{13:[1,49]},{4:50,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{14:51,18:15,19:[1,16],38:[1,23]},{4:52,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{14:53,18:15,19:[1,16],38:[1,23]},{6:54,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{30:[1,56],31:[1,57],32:[1,58],33:[1,59],34:[1,60],35:[1,55]},{6:61,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{1:[2,5],8:[2,5],10:[2,5],13:[2,5],15:[2,5],16:[2,5],21:[2,5]},{1:[2,6],8:[2,6],10:[2,6],13:[2,6],15:[2,6],16:[2,6],21:[2,6]},{1:[2,50],10:[2,50],11:[2,50],13:[2,50],15:[2,50],16:[2,50],21:[2,50],27:[2,50],29:[2,50]},{1:[2,18],16:[2,18],21:[2,18]},{1:[2,9],10:[2,9],13:[2,9],15:[2,9],16:[2,9],21:[2,9]},{11:[1,62],13:[1,63]},{11:[2,24],13:[2,24]},{26:[1,64],28:[1,65]},{1:[2,11],10:[2,11],13:[2,11],15:[2,11],16:[2,11],21:[2,11]},{16:[1,66],21:[1,24]},{16:[1,67],21:[1,24]},{37:[1,68]},{16:[1,69],21:[1,24]},{1:[2,38],13:[2,38],15:[2,38],16:[2,38],21:[2,38]},{16:[1,70],21:[1,24]},{1:[2,14],13:[2,14],16:[2,14],21:[2,14]},{1:[2,7],8:[2,7],10:[2,7],13:[2,7],15:[2,7],16:[2,7],21:[2,7]},{13:[1,71]},{13:[1,72]},{13:[1,73]},{13:[1,74]},{13:[1,75]},{1:[2,37],13:[2,37],15:[2,37],16:[2,37],21:[2,37]},{1:[2,4],8:[2,4],10:[2,4],13:[2,4],15:[2,4],16:[2,4],21:[2,4]},{1:[2,10],10:[2,10],13:[2,10],15:[2,10],16:[2,10],21:[2,10]},{6:45,25:76,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{6:77,18:78,19:[1,79],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{6:45,25:80,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{1:[2,12],10:[2,12],13:[2,12],15:[2,12],16:[2,12],21:[2,12]},{1:[2,41],15:[2,41],16:[2,41],21:[2,41],29:[2,41]},{15:[1,81]},{1:[2,36],15:[2,36],16:[2,36],21:[2,36]},{1:[2,39],13:[2,39],15:[2,39],16:[2,39],21:[2,39]},{18:82,38:[1,23]},{19:[1,83]},{18:84,38:[1,23]},{18:85,38:[1,23]},{18:86,38:[1,23]},{11:[2,25],13:[2,25]},{11:[2,26],13:[2,26],27:[1,87]},{11:[2,27],13:[2,27],27:[1,88]},{11:[2,30],13:[2,30]},{11:[2,31],13:[2,31]},{4:89,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{1:[2,40],15:[2,40],16:[2,40],21:[2,40],29:[2,40]},{1:[2,32],15:[2,32],16:[2,32],21:[2,32]},{1:[2,33],15:[2,33],16:[2,33],21:[2,33]},{1:[2,34],15:[2,34],16:[2,34],21:[2,34]},{1:[2,35],15:[2,35],16:[2,35],21:[2,35]},{11:[2,28],13:[2,28]},{11:[2,29],13:[2,29]},{16:[1,90],21:[1,24]},{1:[2,43],15:[2,43],16:[2,43],21:[2,43],29:[2,43]}],defaultActions:{},parseError:function(t,n){throw new Error(t)},parse:function(t){function v(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}function m(){var e;return e=n.lexer.lex()||1,typeof e!="number"&&(e=n.symbols_[e]||e),e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var p=this.lexer.yylloc;s.push(p);var d=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var g,y,b,w,E,S,x={},T,N,C,k;for(;;){b=r[r.length-1];if(this.defaultActions[b])w=this.defaultActions[b];else{if(g===null||typeof g=="undefined")g=m();w=o[b]&&o[b][g]}if(typeof w=="undefined"||!w.length||!w[0])var L="";if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(w[0]){case 1:r.push(g),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(w[1]),g=null,y?(g=y,y=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:N=this.productions_[w[1]][1],x.$=i[i.length-N],x._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column},d&&(x._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]),S=this.performAction.call(x,u,f,a,this.yy,w[1],i,s);if(typeof S!="undefined")return S;N&&(r=r.slice(0,-1*N*2),i=i.slice(0,-1*N),s=s.slice(0,-1*N)),r.push(this.productions_[w[1]][0]),i.push(x.$),s.push(x._$),C=o[r[r.length-2]][r[r.length-1]],r.push(C);break;case 3:return!0}}return!0}};return t.prototype=e,e.Parser=t,new t}();typeof require!="undefined"&&typeof exports!="undefined"&&(exports.parser=t,exports.Parser=t.Parser,exports.parse=function(){return t.parse.apply(t,arguments)},exports.main=function(t){if(!t[1])throw new Error("Usage: "+t[0]+" FILE");var n,r;return typeof process!="undefined"?n=require("fs").readFileSync(require("path").resolve(t[1]),"utf8"):n=require("file").path(require("file").cwd()).join(t[1]).read({charset:"utf-8"}),exports.parser.parse(n)},typeof module!="undefined"&&require.main===module&&exports.main(typeof process!="undefined"?process.argv.slice(1):require("system").args));var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V={}.hasOwnProperty,$=[].slice,J=function(e,t){function r(){this.constructor=e}for(var n in t)V.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},K=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1};W={async:!1},k=Object.defineProperty,A=function(e,t){return k(e,t,{get:function(){var e;return this.hasOwnProperty("_"+t)||(e=t in Object.getPrototypeOf(this)?Object.create(Object.getPrototypeOf(this)[t]):{},k(this,"_"+t,{configurable:!0,writable:!0,value:e})),this["_"+t]}})},M=function(e,t,n){var r,i;n==null&&(n=!0);for(r in t){if(!V.call(t,r))continue;i=t[r],n?e[r]=i:k(e,r,{value:i,configurable:!0})}return e},T=function(e,t,n){if(e[t]!==n)return e[t]=n},F=function(e,t,n){return n==null&&(n=!0),M(M({},e,n),t,n)},_=function(e,t){return e[t+"_property"]?e[t+"_property"].format():e[t]},B=function(e){return Object.prototype.toString.call(e)==="[object Array]"},q=function(e,t){var n;return n={},n[e]=t,n},z=function(e){var t,n,r,i;if(e&&typeof e.toJSON=="function")return e.toJSON();if(B(e)){i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(z(t));return i}return e},N=function(e){return e.slice(0,1).toUpperCase()+e.slice(1)},U=function(e,t,n){if(!e[t]||e[t].indexOf(n)===-1)return e.hasOwnProperty(t)?e[t].push(n):e[t]?k(e,t,{value:[n].concat(e[t])}):k(e,t,{value:[n]})},R=function(e,t,n){var r;if(e[t]&&(r=e[t].indexOf(n))!==-1)return e.hasOwnProperty(t)||k(e,t,{value:[].concat(e[t])}),e[t].splice(r,1)},f=function(){function e(e,t,n){this.object=e,this.name=t,this.options=n}return k(e.prototype,"async",{get:function(){return"async"in this.options?this.options.async:W.async}}),e.prototype.trigger=function(){var e,t,n=this;return e=1<=arguments.length?$.call(arguments,0):[],this.queue.push(e),this.async?(t=this.queue).timeout||(t.timeout=setTimeout(function(){return n.resolve()},0)):this.resolve()},e.prototype.bind=function(e){return this.options.bind&&this.options.bind.call(this.object,e),U(this.object._s,"listeners_"+this.name,e)},e.prototype.one=function(e){var t,n=this;return t=function(e){return n.unbind(e)},this.bind(function(){return t(arguments.callee),e.apply(this,arguments)})},e.prototype.unbind=function(e){R(this.object._s,"listeners_"+this.name,e);if(this.options.unbind)return this.options.unbind.call(this.object,e)},e.prototype.resolve=function(){var e,t,n,r,i,s=this;t=function(e){if(s.listeners)return s.listeners.forEach(function(t){return t.apply(s.object,e)})};if(this.options.optimize)t(this.options.optimize(this.queue));else{i=this.queue;for(n=0,r=i.length;n<r;n++)e=i[n],t(e)}return this.queue=[]},k(e.prototype,"listeners",{get:function(){return this.object._s["listeners_"+this.name]}}),k(e.prototype,"queue",{get:function(){return this.object._s.hasOwnProperty("queue_"+this.name)||(this.queue=[]),this.object._s["queue_"+this.name]},set:function(e){return this.object._s["queue_"+this.name]=e}}),e}(),L=function(e,t,n){return n==null&&(n={}),"_s"in e||A(e,"_s"),k(e,t,{configurable:!0,get:function(){return new f(this,t,n)}})},i={_identityMap:{},get:function(e,t){var n,r;n=e.uniqueId();if(n&&t)return(r=this._identityMap[n])!=null?r[t]:void 0},set:function(e,t,n){var r,i;r=e.uniqueId();if(r&&t)return(i=this._identityMap)[r]||(i[r]={}),this._identityMap[r][t]=n},unset:function(e,t){var n,r;n=e.uniqueId();if(n&&t)return(r=this._identityMap)[n]||(r[n]={}),delete this._identityMap[n][t]}},j=function(e){return(""+e).match(/^\d+$/)},s=function(){function i(e){var t,n,r,i;e==null&&(e=[]);for(t=r=0,i=e.length;r<i;t=++r)n=e[t],this[t]=n;this.length=(e!=null?e.length:void 0)||0}var e,t,n,r;L(i.prototype,"change_set"),L(i.prototype,"change_add"),L(i.prototype,"change_update"),L(i.prototype,"change_insert"),L(i.prototype,"change_delete"),L(i.prototype,"change"),i.prototype.get=function(e){return this[e]},i.prototype.set=function(e,t){return this[e]=t,j(e)&&(this.length=Math.max(this.length,e+1)),this.change_set.trigger(e,t),this.change.trigger(this),t},i.prototype.update=function(e){var t,n,r,i,s,o;n=this.clone();for(t in this)i=this[t],j(t)&&delete this[t];for(t=s=0,o=e.length;s<o;t=++s)r=e[t],this[t]=r;return this.length=(e!=null?e.length:void 0)||0,this.change_update.trigger(n,this),this.change.trigger(this),e},i.prototype.sortBy=function(e){return this.sort(function(t,n){return t[e]<n[e]?-1:1})},i.prototype.includes=function(e){return this.indexOf(e)>=0},i.prototype.find=function(e){var t,n,r;for(n=0,r=this.length;n<r;n++){t=this[n];if(e(t))return t}},i.prototype.insertAt=function(e,t){return Array.prototype.splice.call(this,e,0,t),this.change_insert.trigger(e,t),this.change.trigger(this),t},i.prototype.deleteAt=function(e){var t;return t=this[e],Array.prototype.splice.call(this,e,1),this.change_delete.trigger(e,t),this.change.trigger(this),t},i.prototype["delete"]=function(e){var t;t=this.indexOf(e);if(t!==-1)return this.deleteAt(t)},k(i.prototype,"first",{get:function(){return this[0]}}),k(i.prototype,"last",{get:function(){return this[this.length-1]}}),i.prototype.toArray=function(){var e,t,n;e=[];for(t in this)n=this[t],j(t)&&(e[t]=n);return e},i.prototype.clone=function(){return new i(this.toArray())},i.prototype.push=function(e){return this[this.length++]=e,this.change_add.trigger(e),this.change.trigger(this),e},i.prototype.pop=function(){return this.deleteAt(this.length-1)},i.prototype.unshift=function(e){return this.insertAt(0,e)},i.prototype.shift=function(){return this.deleteAt(0)},i.prototype.splice=function(){var e,t,n,r,s;return s=arguments[0],e=arguments[1],n=3<=arguments.length?$.call(arguments,2):[],r=this.clone(),t=Array.prototype.splice.apply(this,[s,e].concat($.call(n))),this.change_update.trigger(r,this),this.change.trigger(this),new i(t)},i.prototype.sort=function(e){var t;return t=this.clone(),Array.prototype.sort.call(this,e),this.change_update.trigger(t,this),this.change.trigger(this),this},i.prototype.reverse=function(){var e;return e=this.clone(),Array.prototype.reverse.call(this),this.change_update.trigger(e,this),this.change.trigger(this),this},r=["forEach","indexOf","lastIndexOf","join","every","some","reduce","reduceRight"];for(t=0,n=r.length;t<n;t++)e=r[t],i.prototype[e]=Array.prototype[e];return i.prototype.map=function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],new i(Array.prototype.map.apply(this,e))},i.prototype.filter=function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],new i(Array.prototype.filter.apply(this,e))},i.prototype.slice=function(){var e,t;return e=1<=arguments.length?$.call(arguments,0):[],new i((t=this.toArray()).slice.apply(t,e))},i.prototype.concat=function(){var e,t,n;return t=1<=arguments.length?$.call(arguments,0):[],t=function(){var n,r,s;s=[];for(n=0,r=t.length;n<r;n++)e=t[n],e instanceof i?s.push(e.toArray()):s.push(e);return s}(),new i((n=this.toArray()).concat.apply(n,t))},i.prototype.toString=function(){return this.toArray().toString()},i.prototype.toLocaleString=function(){return this.toArray().toLocaleString()},i.prototype.toJSON=function(){return z(this.toArray())},i}(),n=function(e){function t(e,n,r){var i=this;this.owner=e,this.options=n,this._convert.apply(this,$.call(r).concat([function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],t.__super__.constructor.call(i,e)}]))}return J(t,e),t.prototype.set=function(e,n){var r=this;return this._convert(n,function(n){return t.__super__.set.call(r,e,n)})},t.prototype.push=function(e){var n=this;return this._convert(e,function(e){return t.__super__.push.call(n,e)})},t.prototype.update=function(e){var n=this;return this._convert.apply(this,$.call(e).concat([function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],t.__super__.update.call(n,e)}]))},t.prototype.splice=function(){var e,n,r,i=this;return r=arguments[0],e=arguments[1],n=3<=arguments.length?$.call(arguments,2):[],this._convert.apply(this,$.call(n).concat([function(){var n;return n=1<=arguments.length?$.call(arguments,0):[],t.__super__.splice.apply(i,[r,e].concat($.call(n)))}]))},t.prototype.insertAt=function(e,n){var r=this;return this._convert(n,function(n){return t.__super__.insertAt.call(r,e,n)})},t.prototype._convert=function(){var e,t,n,r,i,s,o;n=2<=arguments.length?$.call(arguments,0,i=arguments.length-1):(i=0,[]),e=arguments[i++],n=function(){var e,r,i;i=[];for(e=0,r=n.length;e<r;e++)t=n[e],(t!=null?t.constructor:void 0)===Object&&this.options.as?i.push(t=new(this.options.as())(t)):i.push(t);return i}.call(this),r=e.apply(null,n);for(s=0,o=n.length;s<o;s++)t=n[s],this.options.inverseOf&&t[this.options.inverseOf]!==this.owner&&(t[this.options.inverseOf]=this.owner);return r},t}(s),P={},X=function(e,t){var n,r,i,s,o,u,a,f;f=[];for(u=0,a=t.length;u<a;u++)r=t[u],P.hasOwnProperty(r)?f.push(function(){var t,u,a,f,l,c,h;a=P[r],h=[];for(t=0,u=a.length;t<u;t++)f=a[t],r=f.name,o=f.type,i=f.object,s=f.subname,n=f.dependency,o==="singular"?e===i[r]?h.push((l=i[n+"_property"])!=null?typeof l.trigger=="function"?l.trigger(i):void 0:void 0):h.push(void 0):o==="collection"?K.call(i[r],e)>=0?h.push((c=i[n+"_property"])!=null?typeof c.trigger=="function"?c.trigger(i):void 0:void 0):h.push(void 0):h.push(void 0);return h}()):f.push(void 0);return f},b=function(){function e(e,t){var n,r,i;this.name=e,M(this,t),this.dependencies=[],this.localDependencies=[],this.globalDependencies=[];if(this.dependsOn){i=[].concat(this.dependsOn);for(n=0,r=i.length;n<r;n++)e=i[n],this.addDependency(e)}}return k(e.prototype,"eventOptions",{get:function(){var e;return e=this.name,{async:this.async!=null?this.async:W.async,bind:function(){return this[e]},optimize:function(e){return e[e.length-1]}}}}),e.prototype.addDependency=function(e){var t,n,r,i;if(this.dependencies.indexOf(e)===-1){this.dependencies.push(e),e.match(/\./)?(n="singular",r=e.split("."),e=r[0],t=r[1]):e.match(/:/)&&(n="collection",i=e.split(":"),e=i[0],t=i[1]),this.localDependencies.push(e),this.localDependencies.indexOf(e)===-1&&this.localDependencies.push(e);if(n)return this.globalDependencies.push({subname:t,name:e,type:n})}},e}(),y=function(){function e(e,t){this.definition=e,this.object=t,this.name=this.definition.name,this.valueName="val_"+this.name,this.event=new f(this.object,this.name+"_change",this.definition.eventOptions)}return e.prototype.set=function(e){var t;return typeof e=="function"?this.definition.get=e:(this.definition.changed&&(t=this.get()),this.definition.set?this.definition.set.call(this.object,e):k(this.object._s,this.valueName,{value:e,configurable:!0}),this.trigger())},e.prototype.get=function(){var e,t,n=this;return this.registerGlobal(),this.definition.get&&!(this.definition.cache&&this.valueName in this.object._s)?(e=function(e){return n.definition.addDependency(e)},"dependsOn"in this.definition||this.object._s.property_access.bind(e),t=this.definition.get.call(this.object),this.definition.cache&&(this.object._s[this.valueName]=t),"dependsOn"in this.definition||this.object._s.property_access.unbind(e)):t=this.object._s[this.valueName],this.object._s.property_access.trigger(this.name),t},e.prototype.format=function(){return typeof this.definition.format=="function"?this.definition.format.call(this.object,this.get()):this.get()},e.prototype.registerGlobal=function(){var e,t,n,r,i,s,o,u;if(!this.object._s["glb_"+this.name]){this.object._s["glb_"+this.name]=!0,s=this.definition.globalDependencies,u=[];for(r=0,i=s.length;r<i;r++)o=s[r],e=o.name,n=o.type,t=o.subname,P[t]||(P[t]=[]),u.push(P[t].push({object:this.object,subname:t,name:e,type:n,dependency:this.name}));return u}},e.prototype.trigger=function(){var e,t,n,r,i,s,o,u;this.clearCache();if(this.hasChanged()){r=this.get(),e={},o=this.dependents;for(i=0,s=o.length;i<s;i++)t=o[i],t!==this.name&&(e[t]=this.object[t]);this.event.trigger(r);for(t in e){if(!V.call(e,t))continue;r=e[t],n=this.object[t+"_property"],n.clearCache(),n.hasChanged()&&n.event.trigger(r)}return e[this.name]=r,(u=this.object.changed)!=null&&typeof u.trigger=="function"&&u.trigger(e),X(this.object,Object.keys(e))}},e.prototype.bind=function(e){return this.event.bind(e)},e.prototype.unbind=function(e){return this.event.unbind(e)},e.prototype.one=function(e){return this.event.one(e)},k(e.prototype,"dependents",{get:function(){var e,t,n=this;return e=[],t=function(r){var i,s,o,u,a,f;u=n.object._s.properties,f=[];for(s=0,o=u.length;s<o;s++)i=u[s],(a=i.name,K.call(e,a)<0)&&K.call(i.localDependencies,r)>=0?(e.push(i.name),f.push(t(i.name))):f.push(void 0);return f},t(this.name),e}}),k(e.prototype,"listeners",{get:function(){return this.event.listeners}}),e.prototype.clearCache=function(){if(this.definition.cache&&this.definition.get)return delete this.object._s[this.valueName]},e.prototype.hasChanged=function(){var e,t,n;return this.definition.changed===!1?!1:this.definition.changed?(n=this.get(),t="old_val_"+this.name,e=this.object._s.hasOwnProperty(t)?this.definition.changed.call(this.object,this.object._s[t],n):!0,this.object._s[t]=n,e):!0},e}(),O=function(e,t,n){var r;n==null&&(n={}),r=new b(t,n),"_s"in e||A(e,"_s"),U(e._s,"properties",r),L(e._s,"property_access"),k(e,t,{get:function(){return this[t+"_property"].get()},set:function(e){return this[t+"_property"].set(e)},configurable:!0,enumerable:"enumerable"in n?n.enumerable:!0}),k(e,t+"_property",{get:function(){return new y(r,this)},configurable:!0}),typeof n.serialize=="string"&&O(e,n.serialize,{get:function(){return this[t]},set:function(e){return this[t]=e},configurable:!0});if("value"in n)return e[t]=n.value},H=1,v=function(){function e(e){var t;if(this.constructor.identityMap&&(e!=null?e.id:void 0)){t=i.get(this.constructor,e.id);if(t)return t.set(e),t;i.set(this.constructor,e.id,this)}this.set(e)}return e.identityMap=!0,e.find=function(e){return i.get(this,e)||new this({id:e})},e.extend=function(e){var t;return t=function(t){function n(){var t;t=n.__super__.constructor.apply(this,arguments);if(t)return t;e&&e.apply(this,arguments)}return J(n,t),n}(this)},e.property=function(){var e,t,n,r,i,s,o;t=2<=arguments.length?$.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],typeof n=="string"&&(t.push(n),n={}),o=[];for(i=0,s=t.length;i<s;i++)e=t[i],o.push(O(this.prototype,e,n));return o},e.event=function(e,t){return L(this.prototype,e,t)},e.delegate=function(){var e,t,n,r,i=this;return e=2<=arguments.length?$.call(arguments,0,r=arguments.length-1):(r=0,[]),t=arguments[r++],n=t.to,e.forEach(function(e){var r,s;return r=e,t.prefix===!0?r=n+N(e):t.prefix&&(r=t.prefix+N(e)),t.suffix===!0?r+=N(n):t.suffix&&(r+=t.suffix),s=F(t,{dependsOn:t.dependsOn||""+n+"."+e,get:function(){var t;return(t=this[n])!=null?t[e]:void 0},set:function(t){var r;return(r=this[n])!=null?r[e]=t:void 0}}),i.property(r,s)})},e.collection=function(e,t){var n;return t==null&&(t={}),n=F(t,{get:function(){var t,n=this;return t="val_"+e,this._s[t]||(this._s[t]=new s([]),this._s[t].change.bind(function(){return n[e+"_property"].trigger()})),this._s[t]},set:function(t){return this[e].update(t)}}),this.property(e,n),this.property(e+"Count",{get:function(){return this[e].length},dependsOn:e})},e.belongsTo=function(e,t){var n;return t==null&&(t={}),n=F(t,{set:function(n){var r,i;i="val_"+e,n&&n.constructor===Object&&t.as&&(n=new(t.as())(n)),r=this._s[i],this._s[i]=n;if(t.inverseOf&&!n[t.inverseOf].includes(this))return r&&r[t.inverseOf]["delete"](this),n[t.inverseOf].push(this)}}),this.property(e,n),this.property(e+"Id",{get:function(){var t;return(t=this[e])!=null?t.id:void 0},set:function(n){if(n!=null)return this[e]=t.as().find(n)},dependsOn:e,serialize:t.serializeId})},e.hasMany=function(e,t){var r;return t==null&&(t={}),r=F(t,{get:function(){var r,i=this;return r="val_"+e,this._s[r]||(this._s[r]=new n(this,t,[]),this._s[r].change.bind(function(){return i[e+"_property"].trigger()})),this._s[r]},set:function(t){return this[e].update(t)}}),this.property(e,r),this.property(e+"Ids",{get:function(){return(new s(this[e])).map(function(e){return e!=null?e.id:void 0})},set:function(n){var r,i;return i=function(){var e,i,s;s=[];for(e=0,i=n.length;e<i;e++)r=n[e],s.push(t.as().find(r));return s}(),this[e].update(i)},dependsOn:e,serialize:t.serializeIds}),this.property(e+"Count",{get:function(){return this[e].length},dependsOn:e})},e.selection=function(e,t){var n;return t==null&&(t={}),n=F(t,{get:function(){return this[t.from].filter(function(e){return e[t.filter]})},dependsOn:""+t.from+":"+t.filter}),this.property(e,n),this.property(e+"Count",{get:function(){return this[e].length},dependsOn:e})},e.uniqueId=function(){if(!this._uniqueId||this._uniqueGen!==this)this._uniqueId=H+=1,this._uniqueGen=this;return this._uniqueId},e.property("id",{serialize:!0,set:function(e){return i.unset(this.constructor,this.id),i.set(this.constructor,e,this),this._s.val_id=e},get:function(){return this._s.val_id}}),e.event("saved"),e.event("changed",{optimize:function(e){var t,n,r,i;n={};for(r=0,i=e.length;r<i;r++)t=e[r],M(n,t[0]);return[n]}}),e.prototype.set=function(e){var t,n,r;r=[];for(t in e){if(!V.call(e,t))continue;n=e[t],t in this||O(this,t),r.push(this[t]=n)}return r},e.prototype.save=function(){return this.saved.trigger()},e.prototype.toJSON=function(){var e,t,n,r,i,s,o,u;n={},o=this._s.properties;for(i=0,s=o.length;i<s;i++)t=o[i],typeof t.serialize=="string"?n[t.serialize]=z(this[t.name]):typeof t.serialize=="function"?(u=t.serialize.call(this),e=u[0],r=u[1],n[e]=z(r)):t.serialize&&(n[t.name]=z(this[t.name]));return n},e.prototype.toString=function(){return JSON.stringify(this.toJSON())},e}(),l=/^[a-zA-Z][a-zA-Z0-9\-_]*/,h=/^[\[\]=\:\-!#\.@]/,w=/^"((?:\\.|[^"])*)"/,d=/^(?:\r?\n[^\r\n\S]*)+/,x=/^[^\r\n\S]+/,r=/^\s*\/\/[^\n]*/,c=["IF","ELSE","COLLECTION","IN","VIEW","UNLESS"],p=function(){function e(){}return e.prototype.tokenize=function(e,t){var n;t==null&&(t={}),this.code=e.replace(/^\s*/,"").replace(/\s*$/,""),this.line=t.line||0,this.indent=0,this.indents=[],this.ends=[],this.tokens=[],this.i=0;while(this.chunk=this.code.slice(this.i))this.i+=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.literalToken();while(n=this.ends.pop())n==="OUTDENT"?this.token("OUTDENT"):this.error("missing "+n);while(this.tokens[0][0]==="TERMINATOR")this.tokens.shift();while(this.tokens[this.tokens.length-1][0]==="TERMINATOR")this.tokens.pop();return this.tokens},e.prototype.commentToken=function(){var e;return(e=r.exec(this.chunk))?e[0].length:0},e.prototype.whitespaceToken=function(){var e;return(e=x.exec(this.chunk))?(this.token("WHITESPACE",e[0].length),e[0].length):0},e.prototype.token=function(e,t){return this.tokens.push([e,t,this.line])},e.prototype.identifierToken=function(){var e,t;return(e=l.exec(this.chunk))?(t=e[0].toUpperCase(),t==="ELSE"&&this.last(this.tokens,2)[0]==="TERMINATOR"&&this.tokens.splice(this.tokens.length-3,1),K.call(c,t)>=0?this.token(t,e[0]):this.token("IDENTIFIER",e[0]),e[0].length):0},e.prototype.stringToken=function(){var e;return(e=w.exec(this.chunk))?(this.token("STRING_LITERAL",e[1]),e[0].length):0},e.prototype.lineToken=function(){var e,t,n,r,i;if(!(n=d.exec(this.chunk)))return 0;t=n[0],this.line+=this.count(t,"\n"),r=this.last(this.tokens,1),i=t.length-1-t.lastIndexOf("\n"),e=i-this.indent;if(i===this.indent)this.newlineToken();else if(i>this.indent)this.token("INDENT"),this.indents.push(e),this.ends.push("OUTDENT");else{while(e<0)this.ends.pop(),e+=this.indents.pop(),this.token("OUTDENT");this.token("TERMINATOR","\n")}return this.indent=i,t.length},e.prototype.literalToken=function(){var e;return(e=h.exec(this.chunk))?(this.token(e[0]),1):this.error("Unexpected token '"+this.chunk.charAt(0)+"'")},e.prototype.newlineToken=function(){if(this.tag()!=="TERMINATOR")return this.token("TERMINATOR","\n")},e.prototype.tag=function(e,t){var n;return(n=this.last(this.tokens,e))&&(t?n[0]=t:n[0])},e.prototype.value=function(e,t){var n;return(n=this.last(this.tokens,e))&&(t?n[1]=t:n[1])},e.prototype.error=function(e){var t;throw t=this.code.slice(Math.max(0,this.i-10),Math.min(this.code.length,this.i+10)),SyntaxError(""+e+" on line "+(this.line+1)+" near "+JSON.stringify(t))},e.prototype.count=function(e,t){var n,r;n=r=0;if(!t.length)return 1/0;while(r=1+e.indexOf(t,r))n++;return n},e.prototype.last=function(e,t){return e[e.length-(t||0)-1]},e}(),m=function(){function e(e,t){this.ast=e,this.element=t,this.children=new s([]),this.boundClasses=new s([])}return L(e.prototype,"load"),L(e.prototype,"unload"),e.prototype.append=function(e){return e.appendChild(this.element)},e.prototype.insertAfter=function(e){return e.parentNode.insertBefore(this.element,e.nextSibling)},e.prototype.remove=function(){var e;return this.unbindEvents(),(e=this.element.parentNode)!=null?e.removeChild(this.element):void 0},k(e.prototype,"lastElement",{configurable:!0,get:function(){return this.element}}),e.prototype.nodes=function(){return this.children},e.prototype.bindEvent=function(e,t){if(e)return this.boundEvents||(this.boundEvents=[]),this.boundEvents.push({event:e,fun:t}),e.bind(t)},e.prototype.unbindEvents=function(){var e,t,n,r,i,s,o,u,a,f,l;this.unload.trigger(),u=this.nodes();for(r=0,s=u.length;r<s;r++)n=u[r],n.unbindEvents();if(this.boundEvents){a=this.boundEvents,l=[];for(i=0,o=a.length;i<o;i++)f=a[i],e=f.event,t=f.fun,l.push(e.unbind(t));return l}},e.prototype.updateClass=function(){var e;return e=this.ast.classes,this.attributeClasses&&(e=e.concat(this.attributeClasses)),this.boundClasses.length&&(e=e.concat(this.boundClasses.toArray())),e.sort(),e.length?T(this.element,"className",e.join(" ")):this.element.removeAttribute("class")},e}(),a=function(e){function t(e){this.ast=e,this.anchor=E.document.createTextNode(""),this.nodeSets=new s([])}return J(t,e),t.prototype.nodes=function(){var e,t,n,r,i,s,o,u;t=[],u=this.nodeSets;for(r=0,s=u.length;r<s;r++){n=u[r];for(i=0,o=n.length;i<o;i++)e=n[i],t.push(e)}return t},t.prototype.rebuild=function(){var e,t,n,r,i,s;if(this.anchor.parentNode){e=this.anchor,i=this.nodes(),s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t.insertAfter(e),s.push(e=t.lastElement);return s}},t.prototype.replace=function(e){var t;return this.clear(),this.nodeSets.update(function(){var n,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(new s(t));return i}()),this.rebuild()},t.prototype.appendNodeSet=function(e){return this.insertNodeSet(this.nodeSets.length,e)},t.prototype.deleteNodeSet=function(e){var t,n,r,i;i=this.nodeSets[e];for(n=0,r=i.length;n<r;n++)t=i[n],t.remove();return this.nodeSets.deleteAt(e)},t.prototype.insertNodeSet=function(e,t){var n,r,i,o,u,a;n=((u=this.nodeSets[e-1])!=null?(a=u.last)!=null?a.lastElement:void 0:void 0)||this.anchor;for(i=0,o=t.length;i<o;i++)r=t[i],r.insertAfter(n),n=r.lastElement;return this.nodeSets.insertAt(e,new s(t))},t.prototype.clear=function(){var e,t,n,r;r=this.nodes();for(t=0,n=r.length;t<n;t++)e=r[t],e.remove();return this.nodeSets.update([])},t.prototype.remove=function(){return this.unbindEvents(),this.clear(),this.anchor.parentNode.removeChild(this.anchor)},t.prototype.append=function(e){return e.appendChild(this.anchor),this.rebuild()},t.prototype.insertAfter=function(e){return e.parentNode.insertBefore(this.anchor,e.nextSibling),this.rebuild()},k(t.prototype,"lastElement",{configurable:!0,get:function(){var e,t;return((e=this.nodeSets.last)!=null?(t=e.last)!=null?t.lastElement:void 0:void 0)||this.anchor}}),t}(m),D=function(e,t){return e.bound&&e.value?_(t,e.value):e.value!=null?e.value:t},g={style:function(e,t,n,r){var i;i=function(){return T(t.element.style,e.name,D(e,n))},i();if(e.bound)return t.bindEvent(n[""+e.value+"_property"],i)},event:function(e,t,n,r){return t.element.addEventListener(e.name,function(i){return e.preventDefault&&i.preventDefault(),r[e.value](t.element,n,i)})},"class":function(e,t,n,r){var i;return i=function(){return n[e.value]?t.boundClasses.includes(e.name)||t.boundClasses.push(e.name):t.boundClasses["delete"](e.name),t.updateClass()},i(),t.bindEvent(n[""+e.value+"_property"],i)},binding:function(e,t,n,r){var i,s,o,u,a;return s=t.element,(a=t.ast.name)==="input"||a==="textarea"||a==="select"||function(){throw SyntaxError("invalid node type "+t.ast.name+" for two way binding")}(),e.value||function(){throw SyntaxError("cannot bind to whole model, please specify an attribute to bind to")}(),i=function(){return n[e.value]=s.type==="checkbox"?s.checked:s.type==="radio"?s.checked?s.getAttribute("value"):void 0:s.value},u=function(){var t;t=n[e.value];if(s.type==="checkbox")return s.checked=!!t;if(s.type!=="radio")return t===void 0&&(t=""),T(s,"value",t);if(t===s.getAttribute("value"))return s.checked=!0},u(),t.bindEvent(n[""+e.value+"_property"],u),e.name==="binding"?(o=function(e){if(s.form===(e.target||e.srcElement))return i()},E.document.addEventListener("submit",o,!0),t.unload.bind(function(){return E.document.removeEventListener("submit",o,!0)})):s.addEventListener(e.name,i)},attribute:function(e,t,n,r){var i,s;return e.name==="binding"?g.binding(e,t,n,r):(i=t.element,s=function(){var r;r=D(e,n);if(e.name==="value")return T(i,"value",r||"");if(t.ast.name==="input"&&e.name==="checked")return T(i,"checked",!!r);if(e.name==="class")return t.attributeClasses=r,t.updateClass();if(r===void 0){if(i.hasAttribute(e.name))return i.removeAttribute(e.name)}else{r===0&&(r="0");if(i.getAttribute(e.name)!==r)return i.setAttribute(e.name,r)}},e.bound&&t.bindEvent(n[""+e.value+"_property"],s),s())},on:function(e,t,n,r){var i;if((i=e.name)==="load"||i==="unload")return t[e.name].bind(function(){return r[e.value](t.element,n)});throw new SyntaxError("unkown lifecycle event '"+e.name+"'")}},o={element:function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p,d;s=E.document.createElement(e.name),o=new m(e,s),e.id&&s.setAttribute("id",e.id),((h=e.classes)!=null?h.length:void 0)&&s.setAttribute("class",e.classes.join(" ")),o.children=C(e.children,t,n),p=o.children;for(a=0,l=p.length;a<l;a++)i=p[a],i.append(s);d=e.properties;for(f=0,c=d.length;f<c;f++){u=d[f],r=g[u.scope];if(!r)throw SyntaxError(""+u.scope+" is not a valid scope");r(u,o,t,n)}return o.load.trigger(),o},view:function(e,t,n){var r,i,s;return r=E.controllerFor(e.argument),r||(s=!0,r=n),i=new a(e),i.replace([E._views[e.argument].nodes(t,r,n,s)]),i},helper:function(e,t,n){var r,i,s,o,u,f,l,c,h;s=new a(e),u=function(t,n){var r,i,s,o,u;t==null&&(t=t),n==null&&(n=n),s=E.document.createDocumentFragment(),i=C(e.children,t,n);for(o=0,u=i.length;o<u;o++)r=i[o],r.append(s);return s},o=E.Helpers[e.command]||function(){throw SyntaxError("no helper "+e.command+" defined")}(),i={render:u,model:t,controller:n},f=function(){var n,r,u;return n=e.arguments.map(function(e){return e.bound?t[e.value]:e.value}),u=function(){var t,s,u,a;u=I(o.apply(i,n)),a=[];for(t=0,s=u.length;t<s;t++)r=u[t],a.push(new m(e,r));return a}(),s.replace([u])},h=e.arguments;for(l=0,c=h.length;l<c;l++)r=h[l],r.bound===!0&&s.bindEvent(t[""+r.value+"_property"],f);return f(),s},text:function(e,t,n){var r,i,s;return r=function(){var n;return n=D(e,t),n===0&&(n="0"),n||""},s=E.document.createTextNode(r()),i=new m(e,s),e.bound&&i.bindEvent(t[""+e.value+"_property"],function(){return T(s,"nodeValue",r())}),i},collection:function(e,t,n){var r,i,s,o,u=this;return i=function(t){return C(e.children,t,n)},o=function(e,t){var n;return e.replace(function(){var e,r,s;s=[];for(e=0,r=t.length;e<r;e++)n=t[e],s.push(i(n));return s}())},s=this.bound(e,t,n,o),r=t[e.argument],s.bindEvent(r.change_set,function(){var e;return s.replace(function(){var t,n,s;s=[];for(t=0,n=r.length;t<n;t++)e=r[t],s.push(i(e));return s}())}),s.bindEvent(r.change_update,function(){var e;return s.replace(function(){var t,n,s;s=[];for(t=0,n=r.length;t<n;t++)e=r[t],s.push(i(e));return s}())}),s.bindEvent(r.change_add,function(e){return s.appendNodeSet(i(e))}),s.bindEvent(r.change_insert,function(e,t){return s.insertNodeSet(e,i(t))}),s.bindEvent(r.change_delete,function(e){return s.deleteNodeSet(e)}),s},"in":function(e,t,n){return this.bound(e,t,n,function(t,r){return r?t.replace([C(e.children,r,n)]):t.clear()})},"if":function(e,t,n){return this.bound(e,t,n,function(r,i){return i?r.replace([C(e.children,t,n)]):e["else"]?r.replace([C(e["else"].children,t,n)]):r.clear()})},unless:function(e,t,n){return this.bound(e,t,n,function(r,i){var s;return i?r.clear():(s=C(e.children,t,n),r.replace([s]))})},bound:function(e,t,n,r){var i,s,o;return i=new a(e),s={},o=function(){var n;return n=t[e.argument],n!==s&&r(i,n),s=n},o(),i.bindEvent(t[""+e.argument+"_property"],o),i}},I=function(e){var t;return e?(t=function(e,t){var n,r,i,s,o,u,a,f;if(typeof t=="string"){r=E.document.createElement("div"),r.innerHTML=t,a=r.children;for(i=0,o=a.length;i<o;i++)n=a[i],e.push(n)}else if(t.nodeName==="#document-fragment"){f=t.childNodes;for(s=0,u=f.length;s<u;s++)n=f[s],e.push(n)}else e.push(t);return e},[].concat(e).reduce(t,[])):[]},C=function(e,t,n){var r,i,s,u;u=[];for(i=0,s=e.length;i<s;i++)r=e[i],u.push(o[r.type](r,t,n));return u},t.lexer={lex:function(){var e,t;return t=this.tokens[this.pos++]||[""],e=t[0],this.yytext=t[1],this.yylineno=t[2],e},setInput:function(e){return this.tokens=e,this.pos=0},upcomingInput:function(){return""}},u=function(){function e(e){this.nodes=e}return e.prototype.remove=function(){var e,t,n,r,i;r=this.nodes,i=[];for(t=0,n=r.length;t<n;t++)e=r[t],i.push(e.remove());return i},k(e.prototype,"fragment",{enumerable:!0,get:function(){var e,t,n,r,i;e=E.document.createDocumentFragment(),i=this.nodes;for(n=0,r=i.length;n<r;n++)t=i[n],t.append(e);return e}}),e}(),S=function(){function e(e,t){this.name=e,this.view=t}return e.prototype.parse=function(){if(typeof this.view!="string")return this.view;try{return this.view=t.parse((new p).tokenize(this.view))}catch(e){throw this.name&&(e.message="In view '"+this.name+"': "+e.message),e}},e.prototype.render=function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],this.compile.apply(this,e).fragment},e.prototype.nodes=function(e,t,n,r){var i;return this.name&&(t||(t=E.controllerFor(this.name,e))),t||(t={}),typeof t=="function"&&(t=new t(e,n)),i=C(this.parse(),e,t),r||typeof t.loaded=="function"&&t.loaded.apply(t,$.call(i.map(function(e){return e.element})).concat([e])),i},e.prototype.compile=function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],new u(this.nodes.apply(this,e))},e}(),E=function(e){var t,n,r;n=Object.create(e);for(t in e)r=e[t],O(n,t,{value:r});return n},M(E,{VERSION:"0.4.1",_views:{},_controllers:{},document:typeof window!="undefined"&&window!==null?window.document:void 0,format:_,defineProperty:O,defineEvent:L,asyncEvents:!1,view:function(e,t){return t?this._views[e]=new S(e,t):new S(void 0,e)},render:function(e,t,n,r,i){return this._views[e].render(t,n,r,i)},controller:function(e,t){return this._controllers[e]=t},controllerFor:function(e){return this._controllers[e]},clearIdentityMap:function(){return i._identityMap={}},clearCache:function(){var e,t,n,r,i;E.clearIdentityMap(),i=[];for(e=n=0,r=P.length;n<r;e=++n)t=P[e],i.push(delete P[e]);return i},unregisterAll:function(){return E._views={},E._controllers={}},Model:v,Collection:s,Cache:i,View:S,Helpers:{}}),k(E,"async",{get:function(){return W.async},set:function(e){return W.async=e}}),e.Serenade=E})(this)
{
"name": "todomvc-serenadejs",
"description": "TodoMVC todo app using Serenade.js",
"version": "0.0.0",
"dependencies": {
},
"devDependencies": {
"serenade": "~0.4.0",
"coffee-script": "~1.6.2"
},
"scripts": {
"compile": "coffee -co js/ js/"
},
"private": true
}
# Serenade.js TodoMVC app
The Serenade.js app has a couple of dependencies which will be necessary if you wish to re-compile the source files.
Running `npm install` from this directory will give you [Serenade.js](http://serenadejs.org/) and [CoffeeScript](http://coffeescript.org/).
### Serenade.js
The latest release of Serenade.js is included in the `js/lib/` folder. The only way to upgrade is either by downloading the source from [their website](http://serenadejs.org/), or by compiling it yourself.
If you wish to compile it yourself, instructions are be available at [Serenade's website](http://serenadejs.org/development.html).
### CoffeeScript
The source code for the TodoMVC app was written in CoffeeScript. If you would like to re-compile the code, follow these instructions.
If you already have CoffeeScript globally installed, just run:
coffee -co js/ js/
If you don't have CoffeeScript globally installed, you may either install it globally...
npm install -g coffee-script
coffee -co js/ js/
...or if you wish to install it just for the purposes of this app...
cd to todomvc/labs/architecture-examples/serenadejs
npm install
npm run-script compile
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment