text: /*!
  * CanJS - 1.1.4 (2013-02-05)
  * http://canjs.us/
  * Copyright (c) 2013 Bitovi
  * Licensed MIT
  */
  (function(z,n,l){var c=z.can||{};if("undefined"===typeof GLOBALCAN||!1!==GLOBALCAN)z.can=c;c.isDeferred=function(a){var b=this.isFunction;return a&&b(a.then)&&b(a.pipe)};var La=0;c.cid=function(a,b){return a._cid?a._cid:a._cid=(b||"")+ ++La};c.each=function(a,b,d){var c=0,f;if(a)if("number"===typeof a.length&&a.pop){a.attr&&a.attr("length");for(f=a.length;c<f&&!1!==b.call(d||a[c],a[c],c,a);c++);}else if(a.hasOwnProperty)for(f in a)if(a.hasOwnProperty(f)&&!1===b.call(d||a[f],a[f],f,a))break;return a};
  n.extend(c,n,{trigger:function(a,b,d){a.trigger?a.trigger(b,d):n.event.trigger(b,d,a,!0)},addEvent:function(a,b){n([this]).bind(a,b);return this},removeEvent:function(a,b){n([this]).unbind(a,b);return this},buildFragment:function(a,b){var d=n.buildFragment,a=[a],b=b||document,b=!b.nodeType&&b[0]||b,b=b.ownerDocument||b,d=d.call(jQuery,a,b);return d.cacheable?n.clone(d.fragment):d.fragment||d},$:n,each:c.each});n.each(["bind","unbind","undelegate","delegate"],function(a,b){c[b]=function(){var a=this[b]?
  this:n([this]);a[b].apply(a,arguments);return this}});n.each("append filter addClass remove data get".split(" "),function(a,b){c[b]=function(a){return a[b].apply(a,c.makeArray(arguments).slice(1))}});var Ma=n.cleanData;n.cleanData=function(a){n.each(a,function(a,d){d&&c.trigger(d,"destroyed",[],!1)});Ma(a)};var Na=/\=\=/,Oa=/([A-Z]+)([A-Z][a-z])/g,Pa=/([a-z\d])([A-Z])/g,Qa=/([a-z\d])([A-Z])/g,ma=/\{([^\}]+)\}/g,Ra=/"/g,Sa=/'/g;c.extend(c,{esc:function(a){return(""+(null===a||a===l||isNaN(a)&&"NaN"===
  ""+a?"":a)).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(Ra,"&#34;").replace(Sa,"&#39;")},getObject:function(a,b,d){var a=a?a.split("."):[],e=a.length,f,h=0,g,i,b=c.isArray(b)?b:[b||z];if(!e)return b[0];for(;b[h];){f=b[h];for(i=0;i<e-1&&/^f|^o/.test(typeof f);i++)f=a[i]in f?f[a[i]]:d&&(f[a[i]]={});if(/^f|^o/.test(typeof f)&&(g=a[i]in f?f[a[i]]:d&&(f[a[i]]={}),g!==l))return!1===d&&delete f[a[i]],g;h++}},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)},
  underscore:function(a){return a.replace(Na,"/").replace(Oa,"$1_$2").replace(Pa,"$1_$2").replace(Qa,"_").toLowerCase()},sub:function(a,b,d){var e=[];e.push(a.replace(ma,function(a,h){var g=c.getObject(h,b,d===l?d:!d);return g===l?(e=null,""):/^f|^o/.test(typeof g)&&e?(e.push(g),""):""+g}));return null===e?e:1>=e.length?e[0]:e},replacer:ma,undHash:/_|-/});var Q=0;c.Construct=function(){if(arguments.length)return c.Construct.extend.apply(c.Construct,arguments)};c.extend(c.Construct,{newInstance:function(){var a=
  this.instance(),b;a.setup&&(b=a.setup.apply(a,arguments));a.init&&a.init.apply(a,b||arguments);return a},_inherit:function(a,b,d){c.extend(d||a,a||{})},_overwrite:function(a,b,d,c){a[d]=c},setup:function(a){this.defaults=c.extend(!0,{},a.defaults,this.defaults)},instance:function(){Q=1;var a=new this;Q=0;return a},extend:function(a,b,d){function e(){if(!Q)return this.constructor!==e&&arguments.length?arguments.callee.extend.apply(arguments.callee,arguments):this.constructor.newInstance.apply(this.constructor,
  arguments)}"string"!=typeof a&&(d=b,b=a,a=null);d||(d=b,b=null);var d=d||{},f=this.prototype,h,g,i,x;x=this.instance();c.Construct._inherit(d,f,x);for(h in this)this.hasOwnProperty(h)&&(e[h]=this[h]);c.Construct._inherit(b,this,e);if(a){i=a.split(".");g=i.pop();i=f=c.getObject(i.join("."),z,!0);var Ta=c.underscore(a.replace(/\./g,"_")),s=c.underscore(g);f[g]=e}c.extend(e,{constructor:e,prototype:x,namespace:i,shortName:g,_shortName:s,fullName:a,_fullName:Ta});e.prototype.constructor=e;g=[this].concat(c.makeArray(arguments));
  x=e.setup.apply(e,g);e.init&&e.init.apply(e,x||g);return e}});var v=function(a){return a&&(c.isArray(a)||c.isPlainObject(a)||a instanceof c.Observe)},R=function(a,b){return c.each(a,function(a){a&&a.unbind&&a.unbind("change"+b)})},S=function(a,b,d,e,f){e=e||k;f=f||k.List;a instanceof k?R([a],d._cid):a=c.isArray(a)?new f(a):new e(a);a.bind("change"+d._cid,function(){var e=c.makeArray(arguments),f=e.shift();e[0]=("*"===b?[d.indexOf(a),e[0]]:[b,e[0]]).join(".");f.triggeredNS=f.triggeredNS||{};f.triggeredNS[d._cid]||
  (f.triggeredNS[d._cid]=!0,c.trigger(d,f,e))});return a},K=function(a,b,d){a.each(function(a,f){d[f]=v(a)&&c.isFunction(a[b])?a[b]():a});return d},G=function(a){return function(){return c[a].apply(this,arguments)}},H=G("addEvent"),G=G("removeEvent"),T=function(a){return c.isArray(a)?a:(""+a).split(".")},na=1,I=0,U=[],V=[],k=c.Observe=c.Construct({bind:H,unbind:G,id:"id",canMakeObserve:v,startBatch:function(a){I++;a&&V.push(a)},stopBatch:function(a,b){a?I=0:I--;if(0==I){var d=U.slice(0),e=V.slice(0);
  U=[];V=[];na++;b&&this.startBatch();c.each(d,function(a){c.trigger.apply(c,a)});c.each(e,function(a){a})}},triggerBatch:function(a,b,d){if(!a._init){if(0==I)return c.trigger(a,b,d);U.push([a,{type:b,batchNum:na},d])}},keys:function(a){var b=[];k.__reading&&k.__reading(a,"__keys");for(var d in a._data)b.push(d);return b}},{setup:function(a){this._data={};c.cid(this,".observe");this._init=1;this.attr(a);this.bind("change"+this._cid,c.proxy(this._changes,this));delete this._init},_changes:function(a,
  b,d,c,f){k.triggerBatch(this,{type:b,batchNum:a.batchNum},[c,f])},_triggerChange:function(a,b,d,e){k.triggerBatch(this,"change",c.makeArray(arguments))},attr:function(a,b){var c=typeof a;if("string"!==c&&"number"!==c)return this._attrs(a,b);if(b===l)return k.__reading&&k.__reading(this,a),this._get(a);this._set(a,b);return this},each:function(){k.__reading&&k.__reading(this,"__keys");return c.each.apply(l,[this.__get()].concat(c.makeArray(arguments)))},removeAttr:function(a){var a=T(a),b=a.shift(),
  c=this._data[b];if(a.length)return c.removeAttr(a);b in this._data&&(delete this._data[b],b in this.constructor.prototype||delete this[b],k.triggerBatch(this,"__keys"),this._triggerChange(b,"remove",l,c));return c},_get:function(a){var a=T(a),b=this.__get(a.shift());return a.length?b?b._get(a):l:b},__get:function(a){return a?this._data[a]:this._data},_set:function(a,b){var c=T(a),e=c.shift(),f=this.__get(e);if(v(f)&&c.length)f._set(c,b);else{if(c.length)throw"can.Observe: Object does not exist";this.__convert&&
  (b=this.__convert(e,b));this.__set(e,b,f)}},__set:function(a,b,c){if(b!==c){var e=this.__get().hasOwnProperty(a)?"set":"add";this.___set(a,v(b)?S(b,a,this):b);"add"==e&&k.triggerBatch(this,"__keys",l);this._triggerChange(a,e,b,c);c&&R([c],this._cid)}},___set:function(a,b){this._data[a]=b;a in this.constructor.prototype||(this[a]=b)},bind:H,unbind:G,serialize:function(){return K(this,"serialize",{})},_attrs:function(a,b){if(a===l)return K(this,"attr",{});var a=c.extend({},a),d,e=this,f;k.startBatch();
  this.each(function(d,g){f=a[g];f===l?b&&e.removeAttr(g):(e.__convert&&(f=e.__convert(g,f)),f instanceof c.Observe?e.__set(g,f,d):v(d)&&v(f)&&d.attr?d.attr(f,b):d!=f&&e.__set(g,f,d),delete a[g])});for(d in a)f=a[d],this._set(d,f);k.stopBatch();return this},compute:function(a){var b=this,d=function(c){return b.attr(a,c)};return c.compute?c.compute(d):d}}),Ua=[].splice,L=k({setup:function(a,b){this.length=0;c.cid(this,".observe");this._init=1;this.push.apply(this,c.makeArray(a||[]));this.bind("change"+
  this._cid,c.proxy(this._changes,this));c.extend(this,b);delete this._init},_triggerChange:function(a,b,c,e){k.prototype._triggerChange.apply(this,arguments);~a.indexOf(".")||("add"===b?(k.triggerBatch(this,b,[c,+a]),k.triggerBatch(this,"length",[this.length])):"remove"===b?(k.triggerBatch(this,b,[e,+a]),k.triggerBatch(this,"length",[this.length])):k.triggerBatch(this,b,[c,+a]))},__get:function(a){return a?this[a]:this},___set:function(a,b){this[a]=b;+a>=this.length&&(this.length=+a+1)},serialize:function(){return K(this,
  "serialize",[])},splice:function(a,b){var d=c.makeArray(arguments),e;for(e=2;e<d.length;e++){var f=d[e];v(f)&&(d[e]=S(f,"*",this))}b===l&&(b=d[1]=this.length-a);e=Ua.apply(this,d);c.Observe.startBatch();0<b&&(this._triggerChange(""+a,"remove",l,e),R(e,this._cid));2<d.length&&this._triggerChange(""+a,"add",d.slice(2),e);c.Observe.stopBatch();return e},_attrs:function(a,b){if(a===l)return K(this,"attr",[]);a=c.makeArray(a);k.startBatch();this._updateAttrs(a,b);k.stopBatch()},_updateAttrs:function(a,
  b){for(var c=Math.min(a.length,this.length),e=0;e<c;e++){var f=this[e],h=a[e];v(f)&&v(h)?f.attr(h,b):f!=h&&this._set(e,h)}a.length>this.length?this.push.apply(this,a.slice(this.length)):a.length<this.length&&b&&this.splice(a.length)}});c.each({push:"length",unshift:0},function(a,b){var c=[][b];L.prototype[b]=function(){for(var b=[],f=a?this.length:0,h=arguments.length,g;h--;)g=arguments[h],b[h]=v(g)?S(g,"*",this,this.constructor.Observe,this.constructor):g;h=c.apply(this,b);(!this.comparator||!b.length)&&
  this._triggerChange(""+f,"add",b,l);return h}});c.each({pop:"length",shift:0},function(a,b){L.prototype[b]=function(){var d=arguments[0]&&c.isArray(arguments[0])?arguments[0]:c.makeArray(arguments),e=a&&this.length?this.length-1:0,d=[][b].apply(this,d);this._triggerChange(""+e,"remove",l,[d]);d&&d.unbind&&d.unbind("change"+this._cid);return d}});c.extend(L.prototype,{indexOf:function(a){this.attr("length");return c.inArray(a,this)},join:[].join,slice:function(){return new this.constructor(Array.prototype.slice.apply(this,
  arguments))},concat:function(){var a=[];c.each(c.makeArray(arguments),function(b,d){a[d]=b instanceof c.Observe.List?b.serialize():b});return new this.constructor(Array.prototype.concat.apply(this.serialize(),a))},forEach:function(a,b){c.each(this,a,b||this)},replace:function(a){c.isDeferred(a)?a.then(c.proxy(this.replace,this)):this.splice.apply(this,[0,this.length].concat(c.makeArray(a||[])));return this}});k.List=L;k.setup=function(){c.Construct.setup.apply(this,arguments);this.List=k.List({Observe:this},
  {})};var Va=function(a,b,d){var e=new c.Deferred;a.then(function(){var a=c.makeArray(arguments);a[0]=b[d](a[0]);e.resolveWith(e,a)},function(){e.rejectWith(this,arguments)});"function"===typeof a.abort&&(e.abort=function(){return a.abort()});return e},Wa=0,oa=/change.observe\d+/,M=function(a){c.Observe.__reading&&c.Observe.__reading(a,a.constructor.id);return a.__get(a.constructor.id)},pa=function(a,b,c,e,f){var h;h=[a.serialize()];var g=a.constructor,i;"destroy"==b&&h.shift();"create"!==b&&h.unshift(M(a));
  i=g[b].apply(g,h);h=i.pipe(function(c){a[f||b+"d"](c,i);return a});i.abort&&(h.abort=function(){i.abort()});h.then(c,e);return h},Xa={create:{url:"_shortName",type:"post"},update:{data:function(a,b){var b=b||{},d=this.id;b[d]&&b[d]!==a&&(b["new"+c.capitalize(a)]=b[d],delete b[d]);b[d]=a;return b},type:"put"},destroy:{type:"delete",data:function(a){var b={};b.id=b[this.id]=a;return b}},findAll:{url:"_shortName"},findOne:{}},qa=function(a,b){return function(d){var d=a.data?a.data.apply(this,arguments):
  d,e=b||this[a.url||"_url"],f=d,h=a.type||"get",g={};"string"==typeof e?(e=e.split(/\s/),g.url=e.pop(),e.length&&(g.type=e.pop())):c.extend(g,e);g.data="object"==typeof f&&!c.isArray(f)?c.extend(g.data||{},f):f;g.url=c.sub(g.url,g.data,!0);return c.ajax(c.extend({type:h||"post",dataType:"json",success:void 0,error:void 0},g))}};c.Model=c.Observe({fullName:"can.Model",setup:function(a){this.store={};c.Observe.setup.apply(this,arguments);if(c.Model){this.List=W({Observe:this},{});var b=this,d=c.proxy(this._clean,
  b);c.each(Xa,function(e,f){c.isFunction(b[f])||(b[f]=qa(e,b[f]));if(b["make"+c.capitalize(f)]){var h=b["make"+c.capitalize(f)](b[f]);c.Construct._overwrite(b,a,f,function(){this._reqs++;var a=h.apply(this,arguments),b=a.then(d,d);b.abort=a.abort;return b})}});if("can.Model"==b.fullName||!b.fullName)b.fullName="Model"+ ++Wa;this._reqs=0;this._url=this._shortName+"/{"+this.id+"}"}},_ajax:qa,_clean:function(a){this._reqs--;if(!this._reqs)for(var b in this.store)this.store[b]._bindings||delete this.store[b];
  return a},models:function(a,b){if(a){if(a instanceof this.List)return a;var d=this,e=[],f=b instanceof c.Observe.List?b:new (d.List||W),h=c.isArray(a),g=a instanceof W,g=h?a:g?a.serialize():a.data;f.length&&f.splice(0);c.each(g,function(a){e.push(d.model(a))});f.push.apply(f,e);h||c.each(a,function(a,b){"data"!==b&&f.attr(b,a)});return f}},model:function(a){if(a){a instanceof this&&(a=a.serialize());var b=a[this.id],b=(b||0===b)&&this.store[b]?this.store[b].attr(a,this.removeAttr||!1):new this(a);
  this._reqs&&(this.store[a[this.id]]=b);return b}}},{isNew:function(){var a=M(this);return!(a||0===a)},save:function(a,b){return pa(this,this.isNew()?"create":"update",a,b)},destroy:function(a,b){if(this.isNew()){var d=this;return c.Deferred().done(function(a){d.destroyed(a)}).resolve(d)}return pa(this,"destroy",a,b,"destroyed")},bind:function(a){oa.test(a)||(this._bindings||(this.constructor.store[this.__get(this.constructor.id)]=this,this._bindings=0),this._bindings++);return c.Observe.prototype.bind.apply(this,
  arguments)},unbind:function(a){oa.test(a)||(this._bindings--,this._bindings||delete this.constructor.store[M(this)]);return c.Observe.prototype.unbind.apply(this,arguments)},___set:function(a,b){c.Observe.prototype.___set.call(this,a,b);a===this.constructor.id&&this._bindings&&(this.constructor.store[M(this)]=this)}});c.each({makeFindAll:"models",makeFindOne:"model"},function(a,b){c.Model[b]=function(b){return function(c,f,h){c=Va(b.call(this,c),this,a);c.then(f,h);return c}}});c.each(["created",
  "updated","destroyed"],function(a){c.Model.prototype[a]=function(b){var d=this.constructor;b&&"object"==typeof b&&this.attr(b.attr?b.attr():b);c.trigger(this,a);c.trigger(this,"change",a);c.trigger(d,a,this)}});var W=c.Model.List=c.Observe.List({setup:function(){c.Observe.List.prototype.setup.apply(this,arguments);var a=this;this.bind("change",function(b,c){if(/\w+\.destroyed/.test(c)){var e=a.indexOf(b.target);-1!=e&&a.splice(e,1)}})}}),Ya=/^\d+$/,Za=/([^\[\]]+)|(\[\])/g,$a=/([^?#]*)(#.*)?$/,ra=
  function(a){return decodeURIComponent(a.replace(/\+/g," "))};c.extend(c,{deparam:function(a){var b={},d;a&&$a.test(a)&&(a=a.split("&"),c.each(a,function(a){for(var a=a.split("="),c=ra(a.shift()),h=ra(a.join("=")),g=b,a=c.match(Za),c=0,i=a.length-1;c<i;c++)g[a[c]]||(g[a[c]]=Ya.test(a[c+1])||"[]"==a[c+1]?[]:{}),g=g[a[c]];d=a.pop();"[]"==d?g.push(h):g[d]=h}));return b}});var sa=/\:([\w\.]+)/g,ab=function(a){var b=[];c.each(a,function(a,e){b.push(("className"===e?"class":e)+'="'+("href"===e?a:c.esc(a))+
  '"')});return b.join(" ")},ta=function(a,b){var c=0,e=0,f={},h;for(h in a.defaults)a.defaults[h]===b[h]&&(f[h]=1,c++);for(;e<a.names.length;e++){if(!b.hasOwnProperty(a.names[e]))return-1;f[a.names[e]]||c++}return c},X=!0,Y=z.location,y=c.each,p=c.extend;c.route=function(a,b){var b=b||{},d=[],e=a.replace(sa,function(e,h,g){d.push(h);return"([^\\"+(a.substr(g+e.length,1)||c.route._querySeparator)+"]"+(b[h]?"*":"+")+")"});c.route.routes[a]={test:RegExp("^"+e+"($|"+(c.route._querySeparator+"").replace(/([.?*+\^$\[\]\\(){}|\-])/g,
  "\\$1")+")"),route:a,names:d,defaults:b,length:a.split("/").length};return c.route};p(c.route,{_querySeparator:"&",_paramsMatcher:/^(?:&[^=]+=[^&]*)+/,param:function(a,b){var d,e=0,f,h=a.route,g=0;delete a.route;y(a,function(){g++});y(c.route.routes,function(b){f=ta(b,a);f>e&&(d=b,e=f);if(f>=g)return!1});c.route.routes[h]&&ta(c.route.routes[h],a)===e&&(d=c.route.routes[h]);if(d){var i=p({},a),h=d.route.replace(sa,function(b,c){delete i[c];return a[c]===d.defaults[c]?"":encodeURIComponent(a[c])}),
  x;y(d.defaults,function(a,b){i[b]===a&&delete i[b]});x=c.param(i);b&&c.route.attr("route",d.route);return h+(x?c.route._querySeparator+x:"")}return c.isEmptyObject(a)?"":c.route._querySeparator+c.param(a)},deparam:function(a){var b={length:-1};y(c.route.routes,function(c){c.test.test(a)&&c.length>b.length&&(b=c)});if(-1<b.length){var d=a.match(b.test),e=d.shift(),f=(e=a.substr(e.length-(d[d.length-1]===c.route._querySeparator?1:0)))&&c.route._paramsMatcher.test(e)?c.deparam(e.slice(1)):{},f=p(!0,
  {},b.defaults,f);y(d,function(a,d){a&&a!==c.route._querySeparator&&(f[b.names[d]]=decodeURIComponent(a))});f.route=b.route;return f}a.charAt(0)!==c.route._querySeparator&&(a=c.route._querySeparator+a);return c.route._paramsMatcher.test(a)?c.deparam(a.slice(1)):{}},data:new c.Observe({}),routes:{},ready:function(a){!1===a&&(X=a);if(!0===a||!0===X)c.route._setup(),ua();return c.route},url:function(a,b){b&&(a=p({},Z,a));return"#!"+c.route.param(a)},link:function(a,b,d,e){return"<a "+ab(p({href:c.route.url(b,
  e)},d))+">"+a+"</a>"},current:function(a){return Y.hash=="#!"+c.route.param(a)},_setup:function(){c.bind.call(z,"hashchange",ua)},_getHash:function(){return Y.href.split(/#!?/)[1]||""},_setHash:function(a){a=c.route.param(a,!0);Y.hash="#!"+a;return a}});y("bind unbind delegate undelegate attr removeAttr".split(" "),function(a){c.route[a]=function(){return c.route.data[a].apply(c.route.data,arguments)}});var va,Z,ua=c.route.setState=function(){var a=c.route._getHash();Z=c.route.deparam(a);(!$||a!==
  wa)&&c.route.attr(Z,!0)},wa,$;c.route.bind("change",function(){$=1;clearTimeout(va);va=setTimeout(function(){$=0;var a=c.route.data.serialize();wa=c.route._setHash(a)},1)});c.bind.call(document,"ready",c.route.ready);("complete"===document.readyState||"interactive"===document.readyState)&&X&&c.route.ready();c.route.constructor.canMakeObserve=c.Observe.canMakeObserve;var H=function(a,b,d){c.bind.call(a,b,d);return function(){c.unbind.call(a,b,d)}},A=c.isFunction,p=c.extend,y=c.each,bb=[].slice,xa=
  /\{([^\}]+)\}/g,cb=c.getObject("$.event.special",[c])||{},ya=function(a,b,d,e){c.delegate.call(a,b,d,e);return function(){c.undelegate.call(a,b,d,e)}},aa;c.Control=c.Construct({setup:function(){c.Construct.setup.apply(this,arguments);if(c.Control){var a;this.actions={};for(a in this.prototype)this._isAction(a)&&(this.actions[a]=this._action(a))}},_shifter:function(a,b){var d="string"==typeof b?a[b]:b;A(d)||(d=a[d]);return function(){a.called=b;return d.apply(a,[this.nodeName?c.$(this):this].concat(bb.call(arguments,
  0)))}},_isAction:function(a){var b=this.prototype[a],c=typeof b;return"constructor"!==a&&("function"==c||"string"==c&&A(this.prototype[b]))&&!(!cb[a]&&!ba[a]&&!/[^\w]/.test(a))},_action:function(a,b){xa.lastIndex=0;if(b||!xa.test(a)){var d=b?c.sub(a,[b,z]):a;if(!d)return null;var e=c.isArray(d),f=e?d[1]:d,h=f.split(/\s+/g),g=h.pop();return{processor:ba[g]||aa,parts:[f,h.join(" "),g],delegate:e?d[0]:l}}},processors:{},defaults:{}},{setup:function(a,b){var d=this.constructor,e=d.pluginName||d._fullName;
  this.element=c.$(a);e&&"can_control"!==e&&this.element.addClass(e);(e=c.data(this.element,"controls"))||c.data(this.element,"controls",e=[]);e.push(this);this.options=p({},d.defaults,b);this.on();return[this.element,this.options]},on:function(a,b,d,e){if(!a){this.off();var a=this.constructor,b=this._bindings,d=a.actions,e=this.element,f=c.Control._shifter(this,"destroy"),h,g;for(h in d)if(d.hasOwnProperty(h)&&(g=d[h]||a._action(h,this.options)))b.push(g.processor(g.delegate||e,g.parts[2],g.parts[1],
  h,this));c.bind.call(e,"destroyed",f);b.push(function(a){c.unbind.call(a,"destroyed",f)});return b.length}"string"==typeof a&&(e=d,d=b,b=a,a=this.element);e===l&&(e=d,d=b,b=null);"string"==typeof e&&(e=c.Control._shifter(this,e));this._bindings.push(b?ya(a,c.trim(b),d,e):H(a,d,e));return this._bindings.length},off:function(){var a=this.element[0];y(this._bindings||[],function(b){b(a)});this._bindings=[]},destroy:function(){var a=this.constructor,a=a.pluginName||a._fullName;this.off();a&&"can_control"!==
  a&&this.element.removeClass(a);a=c.data(this.element,"controls");a.splice(c.inArray(this,a),1);c.trigger(this,"destroyed");this.element=null}});var ba=c.Control.processors;aa=function(a,b,d,e,f){e=c.Control._shifter(f,e);return d?ya(a,c.trim(d),b,e):H(a,b,e)};y("change click contextmenu dblclick keydown keyup keypress mousedown mousemove mouseout mouseover mouseup reset resize scroll select submit focusin focusout mouseenter mouseleave touchstart touchmove touchcancel touchend touchleave".split(" "),
  function(a){ba[a]=aa});c.Control.processors.route=function(a,b,d,e,f){d=d||"";c.route(d);var h,g=function(a){if(c.route.attr("route")===d&&(a.batchNum===l||a.batchNum!==h))if(h=a.batchNum,a=c.route.attr(),delete a.route,c.isFunction(f[e]))f[e](a);else f[f[e]](a)};c.route.bind("change",g);return function(){c.route.unbind("change",g)}};var A=c.isFunction,db=c.makeArray,za=1,j=c.view=function(a,b,d,e){A(d)&&(e=d,d=l);var f=A(e)?function(a){e(j.frag(a))}:null,a=j.render(a,b,d,f),h=c.Deferred();return A(a)?
  a:c.isDeferred(a)?(a.done(function(a,b){h.resolve.call(h,j.frag(a),b)}),h):j.frag(a)};c.extend(j,{frag:function(a,b){return j.hookup(j.fragment(a),b)},fragment:function(a){a=c.buildFragment(a,document.body);a.childNodes.length||a.appendChild(document.createTextNode(""));return a},toId:function(a){return c.map(a.toString().split(/\/|\./g),function(a){if(a)return a}).join("_")},hookup:function(a,b){var d=[],e,f;c.each(a.childNodes?c.makeArray(a.childNodes):a,function(a){1===a.nodeType&&(d.push(a),d.push.apply(d,
  c.makeArray(a.getElementsByTagName("*"))))});c.each(d,function(a){if(a.getAttribute&&(e=a.getAttribute("data-view-id"))&&(f=j.hookups[e]))f(a,b,e),delete j.hookups[e],a.removeAttribute("data-view-id")});return a},hookups:{},hook:function(a){j.hookups[++za]=a;return" data-view-id='"+za+"'"},cached:{},cachedRenderers:{},cache:!0,register:function(a){this.types["."+a.suffix]=a},types:{},ext:".ejs",registerScript:function(){},preload:function(){},render:function(a,b,d,e){A(d)&&(e=d,d=l);var f=eb(b);if(f.length){var h=
  new c.Deferred,g=c.extend({},b);f.push(Aa(a,!0));c.when.apply(c,f).then(function(a){var f=db(arguments),i=f.pop();if(c.isDeferred(b))g=Ba(a);else for(var j in b)c.isDeferred(b[j])&&(g[j]=Ba(f.shift()));f=i(g,d);h.resolve(f,g);e&&e(f,g)});return h}var i,f=A(e),h=Aa(a,f);if(f)i=h,h.then(function(a){e(b?a(b,d):a)});else{if("resolved"===h.state()&&h.__view_id)return a=j.cachedRenderers[h.__view_id],b?a(b,d):a;h.then(function(a){i=b?a(b,d):a})}return i},registerView:function(a,b,d,e){b=(d||j.types[j.ext]).renderer(a,
  b);e=e||new c.Deferred;j.cache&&(j.cached[a]=e,e.__view_id=a,j.cachedRenderers[a]=b);return e.resolve(b)}});var Ca=function(a,b){if(!a.length)throw"can.view: No template or empty template:"+b;},Aa=function(a,b){var d=a.match(/\.[\w\d]+$/),e,f,h;a.match(/^#/)&&(a=a.substr(1));if(f=document.getElementById(a))d="."+f.type.match(/\/(x\-)?(.+)/)[2];!d&&!j.cached[a]&&(a+=d=j.ext);c.isArray(d)&&(d=d[0]);h=j.toId(a);if(a.match(/^\/\//))var g=a.substr(2),a=!z.steal?g:steal.config().root.mapJoin(g);e=j.types[d];
  if(j.cached[h])return j.cached[h];if(f)return j.registerView(h,f.innerHTML,e);var i=new c.Deferred;c.ajax({async:b,url:a,dataType:"text",error:function(b){Ca("",a);i.reject(b)},success:function(b){Ca(b,a);j.registerView(h,b,e,i)}});return i},eb=function(a){var b=[];if(c.isDeferred(a))return[a];for(var d in a)c.isDeferred(a[d])&&b.push(a[d]);return b},Ba=function(a){return c.isArray(a)&&"success"===a[1]?a[0]:a};c.extend(j,{register:function(a){this.types["."+a.suffix]=a;j[a.suffix]=function(b,d){if(!d){var e=
  function(){return j.frag(e.render.apply(this,arguments))};e.render=function(){var c=a.renderer(null,b);return c.apply(c,arguments)};return e}j.preload(b,a.renderer(b,d));return c.view(b)}},registerScript:function(a,b,c){return"can.view.preload('"+b+"',"+j.types["."+a].script(b,c)+");"},preload:function(a,b){function d(){return j.frag(b.apply(this,arguments))}j.cached[a]=(new c.Deferred).resolve(function(a,c){return b.call(a,a,c)});d.render=b;return d}});var fb=function(a,b){var d;c.Observe&&(d=c.Observe.__reading,
  c.Observe.__reading=function(a,b){e.push({obj:a,attr:b})});var e=[],f=a.call(b);c.Observe&&(c.Observe.__reading=d);return{value:f,observed:e}},Da=function(a,b,d){var e={},f=!0,h={value:l,teardown:function(){for(var a in e){var b=e[a];b.observe.obj.unbind(b.observe.attr,i);delete e[a]}}},g,i=function(a){if(a.batchNum===l||a.batchNum!==g){var b=h.value,c=j();h.value=c;c!==b&&d(c,b);g=g=a.batchNum}},j=function(){var d=fb(a,b),g=d.observed,d=d.value;f=!f;c.each(g,function(a){e[a.obj._cid+"|"+a.attr]?
  e[a.obj._cid+"|"+a.attr].matched=f:(e[a.obj._cid+"|"+a.attr]={matched:f,observe:a},a.obj.bind(a.attr,i))});for(var h in e)g=e[h],g.matched!==f&&(g.observe.obj.unbind(g.observe.attr,i),delete e[h]);return d};h.value=j();h.isListening=!c.isEmptyObject(e);return h};c.compute=function(a,b){if(a&&a.isComputed)return a;var d,e=0,f,h=!0;"function"===typeof a?f=function(g){return g===l?d?(e&&c.Observe.__reading&&c.Observe.__reading(f,"change"),d.value):a.call(b||this):a.apply(b||this,arguments)}:(f=function(b){if(b===
  l)return c.Observe.__reading&&c.Observe.__reading(f,"change"),a;var d=a;a=b;d!==b&&c.Observe.triggerBatch(f,"change",[b,d]);return b},h=!1);f.isComputed=!0;c.cid(f,"compute");f.bind=function(g,i){c.addEvent.apply(f,arguments);e===0&&h&&(d=Da(a,b||this,function(a,b){c.Observe.triggerBatch(f,"change",[a,b])}));e++};f.unbind=function(a,b){c.removeEvent.apply(f,arguments);e--;e===0&&h&&d.teardown()};return f};c.compute.binder=Da;var gb=/(\r|\n)+/g,ca={option:"textContent",textarea:"value"},Ea={tr:"tbody",
  option:"select",td:"tr",th:"tr",li:"ul"},Fa=function(a,b,c){if(a)return a;for(;c<b.length;){if("<"==b[c]&&Ea[b[c+1]])return Ea[b[c+1]];c++}},hb=function(a){eval(a)},ib=/([^\s]+)[\s]*=[\s]*$/,B=null,C=null,da=null,u=null,ea=function(){return C?"'"+da.match(ib)[1]+"'":B?1:0};c.view.Scanner=Scanner=function(a){c.extend(this,{text:{},tokens:[]},a);this.tokenReg=[];this.tokenSimple={"<":"<",">":">",'"':'"',"'":"'"};this.tokenComplex=[];this.tokenMap={};for(var a=0,b;b=this.tokens[a];a++)b[2]?(this.tokenReg.push(b[2]),
  this.tokenComplex.push({abbr:b[1],re:RegExp(b[2]),rescan:b[3]})):(this.tokenReg.push(b[1]),this.tokenSimple[b[1]]=b[0]),this.tokenMap[b[0]]=b[1];this.tokenReg=RegExp("("+this.tokenReg.slice(0).concat(["<",">",'"',"'"]).join("|")+")","g")};Scanner.prototype={helpers:[{name:/\s*\(([\$\w]+)\)\s*->([^\n]*)/,fn:function(a){a=a.match(/\s*\(([\$\w]+)\)\s*->([^\n]*)/);return"function(__){var "+a[1]+"=can.$(__);"+a[2]+"}"}}],scan:function(a,b){var c=[],e=0,f=this.tokenSimple,h=this.tokenComplex,a=a.replace(gb,
  "\n");a.replace(this.tokenReg,function(b,g){var i=arguments[arguments.length-2];i>e&&c.push(a.substring(e,i));if(f[b])c.push(b);else for(var j=0,m;m=h[j];j++)if(m.re.test(b)){c.push(m.abbr);m.rescan&&c.push(m.rescan(g));break}e=i+g.length});e<a.length&&c.push(a.substr(e));var g="",i=["var ___v1ew = [];"+(this.text.start||"")],j=function(a,b){i.push("___v1ew.push(",'"',a.split("\\").join("\\\\").split("\n").join("\\n").split('"').join('\\"').split("\t").join("\\t"),'"'+(b||"")+");")},k=[],s,q=null,
  n=!1,r="",o=[],E=0,t,m=this.tokenMap;for(B=C=da=null;(t=c[E++])!==l;){if(null===q)switch(t){case m.left:case m.escapeLeft:case m.returnLeft:n=B&&1;case m.commentLeft:q=t;g.length&&j(g);g="";break;case m.escapeFull:n=B&&1;u=1;q=m.escapeLeft;g.length&&j(g);u=c[E++];g=u.content||u;u.before&&j(u.before);c.splice(E,0,m.right);break;case m.commentFull:break;case m.templateLeft:g+=m.left;break;case "<":0!==c[E].indexOf("!--")&&(B=1,n=0);g+=t;break;case ">":B=0;s="/"==g.substr(g.length-1);n||ca[o[o.length-
  1]]?(s?j(g.substr(0,g.length-1),',can.view.pending(),"/>"'):j(g,',can.view.pending(),">"'),g=""):g+=t;s&&(o.pop(),r=o[o.length-1]);break;case "'":case '"':B&&(C&&C===t?C=null:null===C&&(C=t,da=s));default:"<"===s&&(r=t.split(/\s/)[0],0===r.indexOf("/")&&o.pop()===r.substr(1)?r=o[o.length-1]:o.push(r)),g+=t}else switch(t){case m.right:case m.returnRight:switch(q){case m.left:s=--g.split("{").length- --g.split("}").length;1==s?(i.push("___v1ew.push(","can.view.txt(0,'"+Fa(r,c,E)+"',"+ea()+",this,function(){",
  "var ___v1ew = [];",g),k.push({before:"",after:"return ___v1ew.join('')}));\n"})):(e=k.length&&-1==s?k.pop():{after:";"},e.before&&i.push(e.before),i.push(g,";",e.after));break;case m.escapeLeft:case m.returnLeft:(s=--g.split("{").length- --g.split("}").length)&&k.push({before:"return ___v1ew.join('')",after:"}));"});for(var q=q===m.escapeLeft?1:0,jb={insert:"___v1ew.push(",tagName:Fa(r,c,E),status:ea()},fa=0;fa<this.helpers.length;fa++){var ga=this.helpers[fa];if(ga.name.test(g)){g=ga.fn(g,jb);ga.name.source==
  /^>[\s]*\w*/.source&&(q=0);break}}"object"==typeof g?g.raw&&i.push(g.raw):i.push("___v1ew.push(","can.view.txt("+q+",'"+r+"',"+ea()+",this,function(){ "+(this.text.escape||"")+"return ",g,s?"var ___v1ew = [];":"}));");u&&(u.after&&u.after.length)&&(j(u.after.length),u=null)}q=null;g="";break;case m.templateLeft:g+=m.left;break;default:g+=t}s=t}g.length&&j(g);i.push(";");g={out:"with(_VIEW) { with (_CONTEXT) {"+i.join("")+" return ___v1ew.join('')}}"};hb.call(g,"this.fn = (function(_CONTEXT,_VIEW){"+
  g.out+"});\r\n//@ sourceURL="+b+".js");return g}};var ha=!0;try{document.createTextNode("")._=0}catch(mb){ha=!1}var N={"class":"className",value:"value",innerText:"innerText",textContent:"textContent"},Ga={"":"span",table:"tbody",tr:"td",ol:"li",ul:"li",tbody:"tr",thead:"tr",tfoot:"tr",select:"option",optgroup:"option"},kb=/__!!__/g,ca={option:"textContent"in document.createElement("option")?"textContent":"innerText",textarea:"value"},Ha=c.each(["checked","disabled","readonly","required"],function(a){N[a]=
  a}),ia=function(a,b,d){var e=a.nodeName.toString().toLowerCase(),f=N[b];if(f){if(a[f]=-1<c.inArray(b,Ha)?!0:d,"value"===f&&("input"===e||"textarea"===e))a.defaultValue=d}else a.setAttribute(b,d)},J=[],ja=function(a){if("string"==typeof a)return a;if(!a&&0!==a)return"";var b=a.hookup&&function(b,c){a.hookup.call(a,b,c)}||"function"==typeof a&&a;return b?(J.push(b),""):""+a},lb=function(a){return"string"==typeof a||"number"==typeof a?c.esc(a):ja(a)},F={},O={},P={},ka="ejs_"+Math.random(),la=0,D=function(a){if(ha||
  3!==a.nodeType)return a[ka]?a[ka]:a[ka]=(a.nodeName?"element_":"obj_")+ ++la;for(var b in O)if(O[b]===a)return b;O["text_"+ ++la]=a;return"text_"+la},Ia=function(a,b){var d=F[D(a)];if(d){var e=c.inArray(b,d);0<=e&&d.splice(e,1);d.length||delete F[D(a)]}},Ja=function(a,b){var c=F[D(a)];c||(c=F[D(a)]=[]);c.push(b)},Ka=function(a){a=Ga[a]||"span";return"span"===a?"@@!!@@":"<"+a+">"+Ka(a)+"</"+a+">"};c.extend(c.view,{pending:function(){var a=J.slice(0);lastHookups=a;J=[];return c.view.hook(function(b){c.each(a,
  function(a){a(b)})})},registerNode:function(a){var b=D(a);P[b]=a;c.each(a,function(a){Ja(a,b)})},unregisterNode:function(a){var b=D(a);c.each(a,function(a){Ia(a,b)});delete P[b]},txt:function(a,b,d,e,f){var h=c.compute.binder(f,e,function(a,b){q(a,b)});if(!h.isListening)return(a||0!==d?lb:ja)(h.value);var g,i,j=function(){h.teardown();i&&c.view.unregisterNode(i)},k=function(a){c.bind.call(a,"destroyed",j);g=a},n=function(a){a||(j(),c.unbind.call(g,"destroyed",j))},e=Ga[b]||"span",q,p=ca[b];if(0===
  d&&!p)return"<"+e+c.view.hook(a?function(a,b){q=function(a){d.nodeValue=""+a;n(d.parentNode)};var c=b&&11===a.parentNode.nodeType?b:a.parentNode,d=document.createTextNode(h.value);c.insertBefore(d,a);c.removeChild(a);k(c)}:function(a,b){q=function(a){d[0].parentNode&&e(a);n(d[0].parentNode)};var b=b&&11===a.parentNode.nodeType?b:a.parentNode,d,e=function(e){var f=c.view.frag(e,b),e=c.makeArray(f.childNodes),g=d?d[d.length-1]:a;g.nextSibling?g.parentNode.insertBefore(f,g.nextSibling):g.parentNode.appendChild(f);
  d?(f=c.makeArray(d),c.view.replace(d,e),c.remove(c.$(f))):(c.remove(c.$(a)),i=d=e,c.view.registerNode(d))};e(h.value,[a]);k(b)})+">"+Ka(e)+"</"+e+">";if(1===d){var r=h.value.replace(/['"]/g,"").split("=")[0];J.push(function(a){q=function(b){var b=(b||"").replace(/['"]/g,"").split("="),d=b[0];if(d!=r&&r){var e=r;-1<c.inArray(e,Ha)?a[e]=!1:a.removeAttribute(e)}d&&(ia(a,d,b[1]),r=d)};k(a)});return h.value}var o=0===d?p:d;(0===d?lastHookups:J).push(function(a){q=function(){ia(a,o,g.render(),p)};var b=
  c.$(a),d;(d=c.data(b,"hooks"))||c.data(b,"hooks",d={});var e=(N[o]?a[N[o]]:a.getAttribute(o))||"",b=e.split("__!!__"),f=[],g;f.push(b.shift(),b.join("__!!__"));d[o]?d[o].bindings.push(h):d[o]={render:function(){var a=0;return e.replace(kb,function(){return ja(g.bindings[a++].value)})},bindings:[h],batchNum:l};g=d[o];f.splice(1,0,h.value);ia(a,o,f.join(""),p);k(a)});return"__!!__"},replace:function(a,b){a=c.makeArray(a);c.each(a,function(d){c.each(c.makeArray(F[D(d)]),function(e){var f=P[e],h=c.inArray(d,
  f),g=c.inArray(a[a.length-1],f);if(0<=h&&0<=g){for(var i=h;i<=g;i++)Ia(f[i],e);f.splice.apply(f,[h,g-h+1].concat(b));c.each(b,function(a){Ja(a,e)})}else c.view.unregisterNode(f)})})},canExpando:ha,textNodeMap:O,nodeMap:F,nodeListMap:P});var p=c.extend,w=function(a){if(this.constructor!=w){var b=new w(a);return function(a,c){return b.render(a,c)}}"function"==typeof a?this.template={fn:a}:(p(this,a),this.template=this.scanner.scan(this.text,this.name))};c.EJS=w;w.prototype.render=function(a,b){a=a||
  {};return this.template.fn.call(a,a,new w.Helpers(a,b||{}))};p(w.prototype,{scanner:new c.view.Scanner({tokens:[["templateLeft","<%%"],["templateRight","%>"],["returnLeft","<%=="],["escapeLeft","<%="],["commentLeft","<%#"],["left","<%"],["right","%>"],["returnRight","%>"]]})});w.Helpers=function(a,b){this._data=a;this._extras=b;p(this,b)};w.Helpers.prototype={list:function(a,b){c.each(a,function(c,e){b(c,e,a)})}};c.view.register({suffix:"ejs",script:function(a,b){return"can.EJS(function(_CONTEXT,_VIEW) { "+
  (new w({text:b,name:a})).template.out+" })"},renderer:function(a,b){return w({text:b,name:a})}})})(this,jQuery);
  